Update on the basis of id.

mani123
03:03:11
I have a form that shows data with buttons.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body bgcolor="#cfad5f"text="#1f180a">
<?php

session_start();
$d= $_SESSION['txt_id'];
include ('dbinfo.inc');
echo mysql_error();

$query=mysql_query("SELECT * FROM `login` WHERE `login_id` LIKE '$d'");
if(mysql_num_rows($query) >0){
while($far=mysql_fetch_array($query)){
$level=$far[4];
$dept=$far[3];}
}
$result = mysql_query("SELECT * FROM `request` WHERE `req_for_dept` LIKE '$dept' AND `status` LIKE 'basic'");

echo " <h1><strong><center>Request/s</center></strong></h1>";

///****************** Print out lthe contents of each row into a table *************************///

echo "<body bgcolor='#cfad5f'><table width='90%' border='1' align='center' cellpadding='5' cellspacing='1' bgcolor='' class='text_brown' >";


echo " <tr align='center' >";
echo " <td ><h3>Request no</h3></td>";
echo " <td><h3>Item name</h3></td>";
echo " <td><h3>Request for Department</h3></td>";
echo " <td><h3>Quantity</h3></td>";
echo " <td><h3>Request Date</h3></td>";
echo " <td><h3>Status</h3></td>";
echo " <td><h3>Action</h3></td>";

$field = mysql_fetch_field($result);
if($fields_num = mysql_num_fields($result)){
for($i=0; $i<$fields_num; $i++){
while($val=mysql_fetch_array($result))
{
echo "<tr class=\"black\">";
echo " <td align='center' width='15%'>".$val[0]."</td> ";
echo " <td align='center' width='20%'>".$val[4]."</td> ";
echo " <td align='center' width='25%'>".$val[2]."</td> ";
echo " <td align='center' width='25%'>".$val[6]."</td> ";
echo " <td align='center' width='20%'>".$val[8]."</td> ";
echo " <td align='center' width='20%'>".$val[10]."</td> ";
echo "<td 'align='center' width='80%'>".('<form action="action.php?req_no=<?$val[req_no]?>" method="post">
<div align="center"> <input name="submit" type="submit" value="Accept Request" />
<input name="submit" type="submit" value="Reject Request" />
<input name="hiddenValue" type="hidden" value="$val[0]"/>')."</td>";

echo "</tr>";
}}
echo"</table>";}
else
echo " <body bgcolor='#cfad5f'><h2><strong><center>No Request Found</center></strong></h2>";

?>
</body>
</html>

now I want when the user clicks accept or reject request the status of the request will be updated to approved.
the code I am writing for that is:
session_start();
$d= $_SESSION['txt_id'];
include ('dbinfo.inc');



if (isset($_POST['Yes'])){

$sql =mysql_query("UPDATE TABLE `request` SET `status` = 'approved' WHERE 'req_no'='$_POST['req_no']");



$_SESSION['txt_id'] = $_POST['txt_id'];
header ('Location:success.php');

}
else if (isset($_POST['No'])){
$_SESSION['txt_id'] = $_POST['txt_id'];
header ('Location:req_display.php');

}
?>


But its not working
Kindly Help me sort it out.
Please Login to post your reply or start a new topic