View Full Version : DHTML Help
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
Splinter
24-02-2006, 03:08 PM
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?
Splinter
24-02-2006, 04:22 PM
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 ..
<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..";
}
}
?>
Oops.. meant to edit my old post must have quoted..
Arrrr thats great thanks. How do align the search button and drop down menus?
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.