Jump to content

Archived

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

hansman

Headers W/ Forms

Recommended Posts

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

Share this post


Link to post
Share on other sites
FYI, if this turns into another warez question, it will be deleted/modified.

Share this post


Link to post
Share on other sites
http://www.phpfreaks.com/forums/index.php?action=profile;u=33508;sa=showPosts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
[code]<?
header ("Location: http://www.google.com/search?q=".urlencode($_GET['xyz']));
?>[/code]

Share this post


Link to post
Share on other sites
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.

Regards
Rich

Share this post


Link to post
Share on other sites
im not sure what i did wrong but this is what i came out with http://www.imadetheinternet.com/poo/

Share this post


Link to post
Share on other sites
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]

Regards
Rich

Share this post


Link to post
Share on other sites
thanks a lot for that, now how could i retrn teh results in an iframe on the page that you search from?

Share this post


Link to post
Share on other sites

×

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.