it is working nice.. but when i open the page.. its allways give me this message Undefined variable: list in C:\xampp\htdocs\shed\select.php on line 115
when i submit the page it allways gives me right data.. but allways shows me that undefined variable $list
<?php
include("db.php");
if(isset($_POST['submit']))
{
$aa= mysql_real_escape_string($_POST['loco_name']);
$bb=mysql_real_escape_string ($_POST['section']);
$result=mysql_query("select * from loco_detail Where loco_name= '$aa' AND section= '$bb' ") or die (mysql_error());
$Count = mysql_num_rows($result); // count the output amount
if ($Count > 0)
{
while($row = mysql_fetch_array($result))
{
$name = $row["loco_name"];
$section = $row["section"];
$schedule = $row["schedule"];
$repair = $row["repair"];
$action = $row["action"];
$date = strftime("%b %d, %Y", strtotime($row["date"]));
$list .="
<table id=\"table\" border=\"1\" cellpadding=\"2\" cellspacing=\"2\">
<tr>
<td id=\"row\"> $name </td>
<td id=\"row\"> $schedule </td>
<td id=\"row\"> $repair </td>
<td id=\"row\"> $action </td>
<td id=\"row\"> $date </td>
</tr>
</table>
";
}
} else {
$list = "You have no products listed in your store yet";
}
}
?>
here the html code
<body>
<center>
<fieldset>
<legend>Select</legend>
<table>
<form method="post">
<tr><td>Loco Number:</td><td><input type="text" name="loco_name"/></td></tr>
<tr><td>Section:</td><td><select name="section">
<option value="Mechanical">Mechanical</option>
<option value="Electrical">Electrical</option>
</select></td></tr>
<tr><td><input type="submit" name="submit" value="Submit"></td></tr>
</form>
</table>
</fieldset>
</center>
<div >
<?php echo $list; ?>
</div>
</body>
please make me out from here.