Displaying images on demand - html

I need to make sure that when I enter a request, I get pictures (in google). There is such a line of html code:
<div>
<form action="https://www.google.com/imghp">
<input type="text" name="q">
<input type="submit" value="Google Image Search">
</form>
</div>
But when you enter a request, it simply throws it to the page with a request, where you need to PRESS the search button. Is there any way to make the pictures of my request appear?

For Searching in Google Images, you can use this HTML code:
<form method="GET" action="http://images.google.com/images">
<input type="text" name="q">
<input type="submit" value="Search Google Images">
</form>

Related

How to submit different forms with same input

Im trying to implement the "i'm feeling lucky" functionality in a quite simple web. The thing is that at first, without this button, the query was properly done (i mean when doing a normal search). But, when i included the im feeling lucky button, the normal search stopped working and know even when you click on norma search it goes directly to the firs result. im new to HTML and still lost regarding forms. Note that i cant do it using js cause its for an assignment meant to be done only with HTML.
Thanks a lot for your help :D
Image
Advanced
<form action="https://www.google.com/search?">
<div><input type="text" name="q" id="search"></div>
<div>
<input type="submit" value="Google Search" id="button">
<form>
<input type="hidden" name="btnI" value="1">
<input type="submit" value="I'm feeling lucky" id="button">
</form>
</div>
</form>
In case that you need two buttons with one text field, perhaps a different approach would be useful. Use
<button type="submit" name="action" value="val1"></button>
and
<button type="submit" name="action" value="val2"></button>
but be careful with this one, since some browsers will upload value from the "value" attribute.
The other method is to use some PHP in your script, like this:
<input type="submit" name="update_button" value="Update" />
<input type="submit" name="delete_button" value="Delete" />
<?php
if (isset($_POST['update_button'])) {
//update button
} else if (isset($_POST['delete_button'])) {
//delete button
} else {
//no button was pressed
}
?>
Happy coding!
You cannot nest forms
You need two forms:
Image
Advanced
<form action="https://www.google.com/search?">
<div><input type="text" name="q" id="search"></div>
<div>
<input type="submit" value="Google Search" id="button">
<input type="hidden" name="btnI" value="1">
</div>
</form>
<form action="https://www.google.com/search?"><input type="hidden" name="q" value="I'm feeling lucky"><button>I'm feeling lucky</button></form>
A few notes:
you have a form tag nested inside the other which is wrong.
you have two submit button with same id.
Remove these issues and it will work as desired.
As I see it, you want to have window inside another window, both of which will have buttons? In that case, don't go form inside form, make it div inside div and in both of them, enter a form, here's and example:
<div id="div1">
<form action="https://www.google.com/search?">
<input type="text" name="q" id="search">
<input type="submit" value="Google Search" id="btn1" class="button">
</form>
<div id="div2">
<form action="https://www.google.com/search?">
<input type="text" name="q2" id="search">
<input type="submit" value="Google Search" id="btn2" class="button">
</form>
</div>
</div>

tbm image search filter in image search query

I am trying to mirror the google image search.
so far I know that q is the name for the actual google search (or query).
On the address it will look: www.google.com/search?q=parrot
but on the google image search also appears /search?q=parrot&tbm=ish
I looked and found out that tbm stands for "to be match" and is a filter and I guess is the filter to match the images... but I don't have a clue how to put inside my html code.
So far I have done this:
<form action="https://www.google.com/search" class="form">
<input type="text" name="q" class="search_bar"
<input type="submit" value="Search" class="submit">
</form>
How do I add the tbm filter? Thanks!
You can add a hidden input field and set the value of it.
example
<form action="https://www.google.com/search" class="form">
<input type="text" name="q" class="search_bar">
<input type="hidden" name="tbm" value="ish">
<input type="submit" value="Search" class="submit">
</form>

How do I create a link to google image search via HTML form?

Trying to make Google Image Search Clone using HTML form where after entering text in the search field it will take you directly to Google Image search results page.
Here is the code that I am using:
<body>
<form action="https://google.com/search">
<input type="text" name="q">
<input type="submit" value="Google Search">
</form>
</body>
It will take to normal google search, how do I change it to google image search result page?
You have to change the action, as such:
<form method="get" action="http://images.google.com/images">
<input type="text" name="q" />
<input type="submit" value="Google Search" />
</form>
Google image search link is of the following format
https://www.google.com/search?q=```query```&tbm=isch
Each of the parameters, q and tbm, requires an input tag but tbm does not require any user input.
'GET_parameter_name=value' for every input tag before submit button is appended by '&'.
<form action="https://www.google.com/search">
<input type="text" name="q" id="box">
<input type="hidden" name="tbm" value="isch">
<input type="submit" value="Image Search" >
</form>
Source:
https://stenevang.wordpress.com/2013/02/22/google-advanced-power-search-url-request-parameters/
https://www.xul.fr/javascript/parameters.php

Creating a Google search box using HTML form

So I am trying to insert a search form on my website that will redirect the user with their query to Google Search.
I used to be able to do this using:
<form role="search" method="get" id="searchform" class="searchform" action="http://www.google.co.uk/search?hl=en-GB&source=hp&q=">
<div id="gform">
<label class="screen-reader-text" for="s"></label>
<input type="text" value="" name="s" id="s">
<input type="submit" class="btn fa-input" value="" style="font-family: FontAwesome;">
</div>
</form>
However, this no longer works. I'm guessing this is because Google have changed the search URL, but I am unable to replicate this effect by using Google's current URL.
Any idea how to fix this?
Hi all it seems I have solved the problem myself
<div id="gform">
<label class="screen-reader-text" for="s"></label>
<input type="text" value="" name="q" id="s">
<input type="submit" class="btn fa-input" value="" style="font-family: FontAwesome;">
</div>
The key here that resolved my issue is name="q". This is what you need to make google search work; basically this is because google expects q as the name
This snippet creates a simple google search box
<form action="http://www.google.com/search" method="get">
<input type="text" name="q"/>
<input type="submit" value="search" />
</form>

Multi-search, single search bar HTML

As the title states, I'm trying to incorporate many searches into one search bar. More specifically, Google and Amazon. I have setup a radio option to set which site to search when one is selected.
This is the code I currently have:
<form method="get" action="http://www.google.com/search">
<div align="center" style="font-size:75%">
<input type="text" name="q" size="25" maxlength="255" value="" />
<input type="submit" value="Google or Amazon Search" /></br>
<input type="radio" name="sitesearch" value="" />The Web
<input type="radio" name="sitesearch" value="yoursite.com" checked />This Site
</div>
</form>
I have this form for Amazon, but I'm just unsure how to code it into the one search bar.
<form action="http://amazon.com/s/ref=nb_sb_noss" method="get" target="_blank">
<input type="text" id="twotabsearchtextbox" name="field-keywords">
<input type="submit" value="Search" class="nav-submit-input">
</form>
Use JavaScript to change the actual form action in page's DOM (and other parameters, if needed), depending on the user selection (use onclick event on radio to montior for change for example). Simple as that. You won't be able to do that in pure HTML without using some kind of proxy server to redirect the requests and return the results appropriately.
document.your-form.action = (google_selected) ? "http://www.google.com/search" : "http://amazon.com/s/ref=nb_sb_noss";
etc.