cosmoshell Posted September 16, 2009 Share Posted September 16, 2009 <body><center> <form method="get" action="/search/websearch.php" target="_top"> <table border="0" bgcolor="#ffffff"> <tr><td nowrap="nowrap" valign="top" align="left" height="32"></td> <td nowrap="nowrap"> <label for="sbi" style="display: none">Enter your search terms</label> <input type="text" name="q" size="31" maxlength="255" value="" id="sbi"></input> <label for="sbb" style="display: none">Submit search form</label> <select name=mytextarea> <option name=web value=web> web </option> <option name=images value=images> Images </option> </select> <input type="submit" name="sa" value="Search" id="sbb"></input> </td></tr> <tr> <td> </td> <td nowrap="nowrap"> <table> <tr> <td> <td> </tr> </table> <input type="hidden" name="forid" value="1"></input> <input type="hidden" name="ie" value="UTF-8"></input> <input type="hidden" name="oe" value="UTF-8"></input> <input type="hidden" name="hl" value="en"></input> </td></tr></table> </form> </center><form name=myform> lets say i want web /search/websearch.php and images /search/imagesearch.php how can i do this? Link to comment https://forums.phpfreaks.com/topic/174471-how-can-i-make-a-select-feild-change-the-site-on-this-code/ Share on other sites More sharing options...
Bricktop Posted September 16, 2009 Share Posted September 16, 2009 Hi cosmoshell, In websearch.php, get all of the POSTed data and then with the POSTed "web" and "images" variables perform an if statement like: $web = addslashes($_POST['web']); $images = addslashes($_POST['images']); if($web == "on") { do a web search (insert your web search code here) } else { do an image search (insert your image serach code here) } The above is very basic code which should give you an idea of how to achieve your required searches. Link to comment https://forums.phpfreaks.com/topic/174471-how-can-i-make-a-select-feild-change-the-site-on-this-code/#findComment-919551 Share on other sites More sharing options...
cosmoshell Posted September 16, 2009 Author Share Posted September 16, 2009 Hi cosmoshell, In websearch.php, get all of the POSTed data and then with the POSTed "web" and "images" variables perform an if statement like: $web = addslashes($_POST['web']); $images = addslashes($_POST['images']); if($web == "on") { do a web search (insert your web search code here) } else { do an image search (insert your image serach code here) } The above is very basic code which should give you an idea of how to achieve your required searches. Is there a way to resend the information for example google? from (insert your image serach code here). I know what $_post does now that i read up on it, i just cant figure out how to send from within (). I someone understand varibles now to, so im getting somewhere lol. Im trying to get this so after a search you are brought to and external search result, with at the top of the page there will be a special bar. Link to comment https://forums.phpfreaks.com/topic/174471-how-can-i-make-a-select-feild-change-the-site-on-this-code/#findComment-919642 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.