Jump to content


Photo

Headers W/ Forms


  • Please log in to reply
9 replies to this topic

#1 hansman

hansman
  • Members
  • PipPipPip
  • Advanced Member
  • 100 posts

Posted 06 September 2006 - 09:11 PM

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

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 07 September 2006 - 12:42 PM

FYI, if this turns into another warez question, it will be deleted/modified.

Info: PHP Manual


#3 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 07 September 2006 - 06:51 PM

http://www.phpfreaks...08;sa=showPosts

He is just re-asking his question for help with his warez site again. This topic should be closed.

#4 hansman

hansman
  • Members
  • PipPipPip
  • Advanced Member
  • 100 posts

Posted 07 September 2006 - 07:30 PM

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

#5 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 07 September 2006 - 07:33 PM

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
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#6 hansman

hansman
  • Members
  • PipPipPip
  • Advanced Member
  • 100 posts

Posted 07 September 2006 - 07:50 PM

<?
header ("Location: http://www.google.com/search?q=".urlencode($_GET['xyz']));
?>


#7 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 07 September 2006 - 08:13 PM

Why not have something like this...

HTML Page (Not sure the syntax is exact):
<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>

This calls search.php which looks like this
<?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");
?>

Should work a treat.

Regards
Rich
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#8 hansman

hansman
  • Members
  • PipPipPip
  • Advanced Member
  • 100 posts

Posted 07 September 2006 - 08:25 PM

im not sure what i did wrong but this is what i came out with http://www.imadetheinternet.com/poo/

#9 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 07 September 2006 - 09:15 PM

My bad... I put the wrong values in the php if condition

<?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");
?>

Regards
Rich
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#10 hansman

hansman
  • Members
  • PipPipPip
  • Advanced Member
  • 100 posts

Posted 08 September 2006 - 12:05 AM

thanks a lot for that, now how could i retrn teh results in an iframe on the page that you search from?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users