Possible Duplicate:
PHP MySQL multiple search query using option / select HTML form tags
I'm trying to make a basic search based on a drop down select option. I want to return a result based on the option selected. However, it doesn't seem to be working.
<?php
mysql_connect('localhost','root','');\
mysql_select_db('location');
?>
<center>
<form action="" method="post">
<select name="place">
<option value="one">one</option>
<option value="two">two</option>
<option value="three">three</option>
</select>
<input type="submit" value="search" />
</form>
</center>
<?php
if(isset($_POST['place'])) {
$place = $_POST['place'];
if(!empty($place)) {
$query = "SELECT
description
FROM location
WHERE place LIKE '%$place%'
";
if($query_run = mysql_query($query)) {
if($result = mysql_fetch_assoc($query_run)) {
$description = $result['description'];
echo $description;
}
}
}
}
?>
UPDATE: never mind got it.
mysql_query()works. Refer to the manual for examples. Also turn on error reporting - there will be error messages in the code you show