Hi,
I want to update the status to pending or closed. It is not happening. Pl help me.
Rgds
Sridsam
<?php
$host="localhost"; // Host name
$username="rrrr"; // Mysql username
$password="nnnnn"; // Mysql password
$db_name="ttttt"; // Database name
$tbl_name="elog"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
// Count table rows
$count=mysql_num_rows($result);
?>
<table width="500" border="0" cellspacing="1" cellpadding="0">
<form name="form1" method="post" action="">
<tr>
<td>
<table width="500" border="0" cellspacing="1" cellpadding="0">
<tr>
<td align="center"><strong>ID</strong></td>
<td align="center"><strong>LOCATION</strong></td>
<td align="center"><strong>CATEGORY</strong></td>
<td align="center"><strong>REMARKS</strong></td>
<td align="center"><strong>STATUS</strong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td align="center"><? $id[]=$rows['id']; ?><? echo $rows['id']; ?></td>
<td align="center"><? $id[]=$rows['location']; ?><? echo $rows['location']; ?></td>
<td align="center"><? $id[]=$rows['catgory']; ?><? echo $rows['category']; ?></td>
<td align="left"><? $id[]=$rows['remarks']; ?><? echo $rows['remarks']; ?></td>
<td align="center"><input name="status[]" type="text" id="Status" value="<? echo $rows['status']; ?>"></td>
</tr>
<?php
}
?>
<tr>
<td colspan="4" align="center"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<?php
// Check if button name "Submit" is active, do this
if($submit)
{
for($i=0;$i<$count;$i++)
{
$sql1="UPDATE $tbl_name SET status='$status[$i]'";
$result1=mysql_query($sql1);
}
}
if($result1){
header("location:estatus.php");
}
mysql_close();
?>