السلام عليكم...
أرجو المساعدة أخوانني..فقد عملت صفحة من خلالها اذا وضعت رقم يقوم بالبحث ويجلب لي كل محتويات هذا الصف...ولكن لدي مشكلة بها ...الكود يجي أن يقوم ببعث المتغير (flatnumber ) عند الضغط على seach حتى يقوم الكود بالبحث عن كل العناصر واظهارها...ولكنه لا يقوم بارسال هذه القيمة ..
وهذا هو كود صفحة search.html
<form name="search3" action="search3.php" method="post"> <table width="40%" border="0" cellspacing="4" cellpadding="4" align="center"> <tr> <td align="center"> <h4>Search</h4> </td> </tr> <tr> <td align="center"><input name="flatnumber" type="text" /></td> </tr> <tr> <td align="center"><input name="submit" type="submit" value="Submit" /></td> </tr> </table> </form>
وهذا كود search.php
<?php
$flatnumber='NO data sent';
$db=mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('company');
echo'<table width="670" border="1" cellspacing="0" cellpadding="0" align="center">';
echo'<tr bgcolor="#0090A8">';
echo'<td align="center" class="tableheader">ID</td>';
echo'<td align="center" bgcolor="#0090A8" class="tableheader">Flat Number</td>';
echo'<td align="center" class="tableheader">Reserved</td>';
echo'</tr>';
/*additional data checking and striping*/
$result=mysql_query("SELECT * FROM flats WHERE flatnumber='{$_POST['flatnumber']}'",$db) or die(mysql_error());
/*If there is a matching row*/
if(mysql_num_rows($result) > 0)
{
$_SESSION['flatnumber'] = $_POST['flatnumber'];
$ID = $row['ID'];
$reserv = $row['reserv'];
echo $flatnumber;
}
else
{
$flatnumber2= 'this is flat not exist';
echo '<div align="center"><font size="5" color="red">'.$flatnumber2.'</font></div>';
}
echo '<tr>';
echo '<td align=center>' .$ID. '</td>';
echo '<td align=center> ' .$flatnumber. '</td>';
echo '<td align=center>' .$reserv. '</td>';
echo "</tr>";
echo'</table>';
mysql_free_result($result);
mysql_close($db);
//you may echo the data anywhere in the file
?>