Jump to content

form action Google search with user input


wfletch24

Recommended Posts

Hi guys, I have a question that I hope has a simple solution. Here is what I am trying to achieve.
 
User adds in a type in the input field, selects a state from the drop down, and clicks search.
 
Upon clicking search the browser opens up a Google search in a new window with the type and the selected state.
 
For example: If the user input restaurant and selected Ohio as the state it would Google search in a new window restaurant Ohio
 
I have also attached two images showing what I am trying to achieve.
 
Here is the code I have so far:
 
<?php 
echo'<form action="http://www.google.com/search" method="get" target= _blank>
  <label>Type: <input type="search" name="q"></label>
  <input type="submit" value="Search">
</form>';

echo'Select a state:<br />
<select name="state">
<option value="Ohio">Ohio</option>
<option value="Indiana">Indiana</option>
<option value="College">Florida</option></select>:<br />
';
?> 

 

post-166507-0-08081800-1384960746_thumb.png

post-166507-0-98896200-1384960746_thumb.png

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.