Hi, I need help with some drop-down menus. I want to create a specified search using selections made from the drop down menus. How do i link what it is selected to my data which will just select the desired information.
Thanks
Hi, I need help with some drop-down menus. I want to create a specified search using selections made from the drop down menus. How do i link what it is selected to my data which will just select the desired information.
Thanks
Sometimes..
All you have..
Is 24 Hours....
The End...
Is where we Start from...
Can you make it abit more specific please.. do you mean if you click on a drop down link you want it to be searched for or what?
EDIT: I think I understand you now.. well I would place your search query's into an array and then query them.. ill take it that your using a mysql database ..Originally Posted by Splinter
Can you make it abit more specific please.. do you mean if you click on a drop down link you want it to be searched for or what?
Oops.. meant to edit my old post must have quoted..PHP Code:<html>
<head>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
Search: <select name="query1"><option>Name</option></select>
<select name="query2"><option>Type</option></select>
<select name="query3"><option>Colour</option></select>
<select name="query4"><option>Time</option></select>
<input type="submit" value="Search" name="search" />
</body>
</html>
<?php
if(isset($_POST['search'])) {
$query1 = $_POST['query1'];
$query2 = $_POST['query2'];
$query3 = $_POST['query3'];
$query4 = $_POST['query4'];
$array($query1, $query2, $query3, $query4);
foreach ($array as $query) {
$search = mysql_query("SELECT * FROM database WHERE info LIKE '%$query%'");
}
$count = mysql_num_rows($search);
echo "We have found<b>$count</b> matches to your search!<br />!";
while($row = mysql_fetch_array($search)) {
echo "Put your results here..";
}
}
?>
Last edited by Splinter; 24-02-2006 at 04:27 PM.
Arrrr thats great thanks. How do align the search button and drop down menus?
Sometimes..
All you have..
Is 24 Hours....
The End...
Is where we Start from...
Want to hide these adverts? Register an account for free!