Possible Duplicate:
PHP, MySQL validation malfunction and search doesn't work?
I have created a form, every thing is working fine, except the search. For example whenever a user input any value in the search box, it will display the result from the database, example name of the employee and etc... Please see my coding below...
<html>
<head>
<?php
//require_once('student_form.php');
if(isset($_POST['search'])){
$id=$_REQUEST['id'];
$fname=$_POST['fname'];
//connect to the database
include('connection.php');
//-query the database table
$sql=mysql_query("SELECT * FROM members WHERE (FirstName LIKE '". $fname ."%' OR LastName LIKE '". $lname ."%'");
//-run the query against the mysql query function
$result=mysql_query($sql);
if($row=mysql_fetch_array($result)){
$fname=$row['FirstName'];
$lname=$row['LastName'];
/*$email=$row['Email'];
$age =$row['Age'];
$gender=$row['Gender'];
$course = $row['Course'];*/
}
//-display the result of the array
else
{
<?php echo $rows['FirstName']; ?>
<?php echo $rows['LastName']; ?>
}
}
?>
</head>
<body>
<form action="search.php" method="post">
<table>
<tr>
<td><strong>search box</strong></td>
<td><strong>:</strong></td>
<td><input type="text" name="search" value=""size="30"/><input type="submit" name="s1" value="Search"/></td>
</table>
</form>
</body>
</html>