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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.