hello,
i have the form which has text box called hotel name and a button called "GO"..
whn i insert the hotel name in d box and click on "GO" button, i need to select the exact match from database and display on the page..
here is the form tht allows hotel name to b entered..
<html>
<head>
<title>Search Hotel name</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
echo'<form method="Post" action="select_list.php">';
echo "<table border='0'>";
echo"<tr><td valign=top align='left'>Hotel Name</td><td valign=top width=67%><input type=text name=hotelname value=".$hotelname."></td></tr>";
echo"<tr><td colspan=2 align=right><input type=submit value=Go></td></tr>";
echo"</table>";
echo"</form>";
?>
</body>
</html>
here is d PHP code tht shld retrieve data from tables;;
<html>
<head>
<title>select List</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
mysql_select_db('Travel') or die("cannot select the database");
$hotelname=$_POST['hotelname'];
$query="SELECT Hotel_name FROM hoteldetails ";
if($hotelname).$query.= "AND hotel_name LIKE '%$hotelname%'";
$query.="ORDER BY hotel_name ";
$result=mysql_query($query) or die ("Query failed:" );
echo'<table border="1"><tr><td>Hotel Name</td></tr>';
while(list($hotelname)=mysql_fetch_row($result)){
echo'<tr><td>$hotelname</td></tr>';
}
echo'</table>';
?>
</body>
</html>
bt it is not able to retrive data..plz help me out
thanks..