Hi,tried to update the improvement_plan table with the records below but unable to do so, as the records are not updated. When i click submit button, no records are saved. Please advise? Thanks.
<?php
error_reporting(E_ALL ^ E_NOTICE);
mysql_connect("localhost","user","");
mysql_select_db("p1");
$table="improvement_plan";
if(isset($_POST['submit'])){
// echo $_SESSION['Picid'];
echo $_SESSION['Progressid'];
foreach($_POST['Ipid'] as $value) {
$Item2 = $_POST['Item2' . $value];
$Business2 = $_POST['Business2' . $value];
$Rootcause2 = $_POST['Rootcause2' . $value];
$Progressid = $_SESSION['Progressid'. $value];
mysql_query("UPDATE $table SET Item2='$Item2', Business2='$Business2', Rootcause2='$Rootcause2',Progressid = '$Progressid' where Progressid='".$_SESSION["Progressid"]."'");
echo "Record ".$value." successfully updated.<br />";
}
}
echo "<form action='#' method='post'>
<table border='1'>
<tr>
<th>Ipid</th>;
<th>Item</th>;
<th>Business Enablers/ISO Clause</th>;
<th>Root Cause</th>;
</tr>";
$Ipid=0;
if (isset($_GET['Ipid'])) {
$_SESSION['Ipid']=$_GET['Ipid'];
$Ipid=$_SESSION['Ipid'];
echo $Ipid;
}
$sql = "SELECT * FROM $table where Ipid='$Ipid'";
$results = mysql_query($sql);
while($row = mysql_fetch_assoc($results))
{
$Ipid = $row["Ipid"];
$Item2 = $row["Item2"];
$Business2 = $row["Business2"];
$Rootcause2 = $row["Rootcause2"];
$Progressid = $_SESSION["Progressid"];
echo "<tr>
<td><input type='text' name='Ipid' value='$Ipid' readonly></td>
<td><input type='text' name='Item2' value='$Item2'></td>
<td><input type='text' name='Business2' value='$Business2'></td>
<td><input type='text' name='Rootcause2' value='$Rootcause2'></td>
<td><input type='text' name='Progressid' value='$Progressid' readonly></td>
</tr>";
}
echo "</table><input type='submit' name='submit' value='Update'></form>";
?>