I new to all of php and I am trying to design a search form for my vistors to look at houses.
I am putting all the homes in the database with fields such as, models name, sqft, bed, bath, garage, price, and dwelling.
I have a basic search right now but I can't seem to add on more functions. I can only search one field at a time through the form.
here is my code.....
the form
<form method="post" action="search.php">
<input type="text" name="search" size=25 maxlength=25>
<br>
<select name="bed">
<option value="2">2</option>
<option value="3">3</option>
</select>
<br>
<br>
<input type="Submit" name="Submit" value="Submit">
</form>
the search.php
<?
mysql_connect("localhost","user","password");
//select which database you want to edit
mysql_select_db("gatorw56_homesearch");
$search=$_POST["search"];
$result = mysql_query("SELECT * FROM homes WHERE models LIKE '%$search%'");
while($r=mysql_fetch_array($result))
{
$models=$r["models"];
$bed=$r["bed"];
$who=$r["who"];
$date=$r["date"];
$time=$r["time"];
$id=$r["id"];
//display the row
echo "$models <br> $bed <br> $who <br> $date | $time <br>";
}
?>
Like I said before, it will only allow me to search by one search function.
can someone guide me in the right direction???
I have been looking all these books and websites. The only information I find is about inserting or deleting records. Nothing much about searching the records and displaying.
Is there a tutorial or book that be very beneficial to me?