Hello,
I do not know if I fully comprehend the use of post. My understanding was that because $_POST was a superglobal, the values set applied to all pages after having been set. Here is the problem I am facing.
1) User enters an id number into field to delete x record:
<form action="update_delete.php" method="post">
Player I.D. <input type="text" name="pid" maxlength=10 size=5><br>
<input type="Submit" value="Delete" name="Delete">
<input type="Submit" value="Update" name="Update">
</form>
2) Information is called and used in delete query:
$pid = $_POST['pid'];
@$delete = $_POST['Delete'];
@$update = $_POST['Update'];
if(isset($update))
{
//Do update here..
}
else
if(isset($delete))
{
$sql = "DELETE FROM player WHERE id = {$pid}";
$result = mysql_query($sql, $connection)
or die("Database query failed: " . mysql_error());
echo "Row deleted!";
}
3) Value of pid reported to user:
@ $pid = $_POST['pid'];
?>
<html>
<body><br><br>
Record(s): <?php echo "$pid" ?> have been deleted.
</body>
</html>
My problem ends in step 3 where the record is reported back. The $pid variable is not echoed and I see no feedback suggesting that $pid was not set. Perhaps there is something wrong in the code on step 3?