I need to have a secrch function on the front page of the software for a database project.
This search function need to be able to search 3 different databases for information.
I have already implemented the php to get the data all i need is a method of having a drop down box with the option of which type of data you are searching followed by the string you wish to search for.
The only thing is one you have selected the drop down box, this information isnt set until you submit the form, thus how does the form know which php file to send the POST data to.
I have implemented a loop back to the page but it requires an extra submit to be pressed once the data has been entered.
Is there a better way of doing this?
yes its messy and far from final. your help is greatly appreciated though.
Edd
This search function need to be able to search 3 different databases for information.
I have already implemented the php to get the data all i need is a method of having a drop down box with the option of which type of data you are searching followed by the string you wish to search for.
The only thing is one you have selected the drop down box, this information isnt set until you submit the form, thus how does the form know which php file to send the POST data to.
I have implemented a loop back to the page but it requires an extra submit to be pressed once the data has been entered.
Is there a better way of doing this?
Code:
<?php
if (@$_POST['Selection'] == "item")
{
echo "<form action = 'itemlist.php' method = 'POST' id = 'item'><table>";
$bob = @$_POST['Search'];
echo "<Input type = 'hidden' name ='Search' value = '$bob'></form>";
}
elseif (@$_POST['Selection'] == "user")
{
echo "<form action = 'userlist.php' method = 'POST' id='user'><table>";
$bob = @$_POST['Search'];
echo "<Input type = 'hidden' name ='Search' value = '$bob'></form>";
}
elseif (@$_POST['Selection'] == "loan")
{
echo "<form action = 'loanlist.php' method = 'POST' id ='loan'><table>";
$bob = @$_POST['Search'];
echo "<Input type = 'hidden' name ='Search' value = '$bob'></form>";
}
elseif (@$_POST['Selection'] == "")
{
echo "<form action = 'main.php' method = 'POST'><table>";
echo"<td style = width: 33%'><p>
<span class='bold_large'><tr>";
echo "<select name ='Selection'>";
echo "<option value = 'item'> Item\n
<option value = 'user'> User\n
<option value = 'loan'> Loan\n";
echo "</select>";
echo "</td></tr>";
echo"<td style = width: 66%'><p>
<span class='bold_large'>";
echo "<tr><td><Input type = 'text' name ='Search' size = '20' maxlength='76'>";
echo "</td></tr>";
}
?>
<tr>
<td colspan = '2' style = 'text-align: center'>
<Input type = 'submit' value = 'Search'>
</td></tr></table></form>
yes its messy and far from final. your help is greatly appreciated though.
Edd