Do you want a PHP solution or a javascript solution? The following is a PHP solution:
Code:
<?php
if ($_POST['act'] == "do_search") { //if the action is do_search
if ($_POST['q'] == "" || $_POST['se'] == "") { //if query or search engine is blank
header('Refresh:3; url='.$_SERVER["PHP_SELF"]);
echo 'You must enter a search query and select a search engine to search!';
}
else {
if ($_POST['se'] == "google") {
header('Location: http://www.google.com/search?hl=en&q='.$_POST["q"].'&btnG=Google+Search');
}
elseif ($_POST[''] == "hotbot") {
header('Location: http://hotbot.com/?query='.$_POST["q"].'&ps=&loc=searchbox&tab=web&mode=search&currProv=ask ');
}
else {
header('Location: '.$_SERVER["PHP_SELF"]);
}
}
else { //if form not submitted
?>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
<input type="hidden" name="act" value="do_search">
Search: <input type="text" name="q" value=""><BR>
<input type="radio" name="se" value="google">Google <input type="radio" name="se" value="hotbot"><BR>
<input type="submit" value="Search">
</form>
<?php
}
?>
Added Later: If you want to make the search form on a seperate page, then have it target the specified frame, try the following:
Code:
<form action="filename.php" method="POST" target="framename">
<input type="hidden" name="act" value="do_search">
Search: <input type="text" name="q" value=""><BR>
<input type="radio" name="se" value="google">Google <input type="radio" name="se" value="hotbot"><BR>
<input type="submit" value="Search">
</form>
Where filename.php is the filename of the script above, and the framename is your target frame.
Hope this helps.
Bookmarks