wfletch24 Posted November 20, 2013 Share Posted November 20, 2013 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 /> '; ?> Link to comment https://forums.phpfreaks.com/topic/284101-form-action-google-search-with-user-input/ Share on other sites More sharing options...
digibucc Posted November 20, 2013 Share Posted November 20, 2013 The best way would be to use google's own api made for this: https://developers.google.com/custom-search/json-api/v1/overview the free edition will contain ads. another alternative: http://stackoverflow.com/questions/9392818/i-want-to-curl-google-search-result-in-php Link to comment https://forums.phpfreaks.com/topic/284101-form-action-google-search-with-user-input/#findComment-1459215 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.