hansman Posted September 6, 2006 Share Posted September 6, 2006 i would like to make a search page in which i can search google, and yahoo. The user may specify what site they with to use by a drop down menu, how can i code the page so that the options in teh drop down menu will use the right header..?and can i put more then one header on a page..thanks in advance Link to comment https://forums.phpfreaks.com/topic/19946-headers-w-forms/ Share on other sites More sharing options...
ober Posted September 7, 2006 Share Posted September 7, 2006 FYI, if this turns into another warez question, it will be deleted/modified. Link to comment https://forums.phpfreaks.com/topic/19946-headers-w-forms/#findComment-87691 Share on other sites More sharing options...
Daniel0 Posted September 7, 2006 Share Posted September 7, 2006 http://www.phpfreaks.com/forums/index.php?action=profile;u=33508;sa=showPostsHe is just re-asking his question for help with his warez site again. This topic should be closed. Link to comment https://forums.phpfreaks.com/topic/19946-headers-w-forms/#findComment-87908 Share on other sites More sharing options...
hansman Posted September 7, 2006 Author Share Posted September 7, 2006 i am not asking this question for the warez site, i plan to make a site in whitch i can display major search engine results, simply on my page, this is not like the other idea for the warez search Link to comment https://forums.phpfreaks.com/topic/19946-headers-w-forms/#findComment-87939 Share on other sites More sharing options...
HuggieBear Posted September 7, 2006 Share Posted September 7, 2006 I think we should put the 'Warez' issues behind us for now, and maybe Hansman will think twice before posting content like that again.. Benefit of the doubt time...OK, so what do you mean by header?Rich Link to comment https://forums.phpfreaks.com/topic/19946-headers-w-forms/#findComment-87940 Share on other sites More sharing options...
hansman Posted September 7, 2006 Author Share Posted September 7, 2006 [code]<?header ("Location: http://www.google.com/search?q=".urlencode($_GET['xyz']));?>[/code] Link to comment https://forums.phpfreaks.com/topic/19946-headers-w-forms/#findComment-87948 Share on other sites More sharing options...
HuggieBear Posted September 7, 2006 Share Posted September 7, 2006 Why not have something like this...HTML Page (Not sure the syntax is exact):[code]<form name="search" method="GET" action="search.php"> <select name="engine"> <option name="google">Google.com</option> <option name="yahoo">Yahoo.com</option> </select> <input type="text" name="string"></form>[/code]This calls search.php which looks like this[code]<?php $engine = urlencode($_GET['engine']); $string = urlencode($_GET['string']); if ($engine == "google"){ $url = "http://www.google.com/search?q=$string"; } elseif ($engine == "yahoo"){ $url = "http://search.yahoo.com/search?p=$string"; } header("Location: $url");?>[/code]Should work a treat.RegardsRich Link to comment https://forums.phpfreaks.com/topic/19946-headers-w-forms/#findComment-87964 Share on other sites More sharing options...
hansman Posted September 7, 2006 Author Share Posted September 7, 2006 im not sure what i did wrong but this is what i came out with http://www.imadetheinternet.com/poo/ Link to comment https://forums.phpfreaks.com/topic/19946-headers-w-forms/#findComment-87969 Share on other sites More sharing options...
HuggieBear Posted September 7, 2006 Share Posted September 7, 2006 My bad... I put the wrong values in the php if condition[code]<?php $engine = urlencode($_GET['engine']); $string = urlencode($_GET['string']); if ($engine == "Google.com"){ $url = "http://www.google.com/search?q=$string"; } elseif ($engine == "Yahoo.com"){ $url = "http://search.yahoo.com/search?p=$string"; } header("Location: $url");?>[/code]RegardsRich Link to comment https://forums.phpfreaks.com/topic/19946-headers-w-forms/#findComment-88000 Share on other sites More sharing options...
hansman Posted September 8, 2006 Author Share Posted September 8, 2006 thanks a lot for that, now how could i retrn teh results in an iframe on the page that you search from? Link to comment https://forums.phpfreaks.com/topic/19946-headers-w-forms/#findComment-88070 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.