hello,
i learned recently how to use hidden variables, and its features. but i have some problems when i use more than 3 values :S
this is a portion of the code:
<?php
$hidden = $_POST['action'];
if ($hidden==0) //present the form, note the value of hidden
{
?>
<form action = "<? echo $_SERVER['PHP_SELF']; ?>" method="post">
<table>
<tr align="center">
<td colspan="2"><input name="update" type="submit" value="Update User Data"></td>
<td colspan="2"><input name="delete" type="submit" value="Delete User"></td>
</tr>
<input type="hidden" name="action" value="1">
</table>
</form>
<!-- here is the delete section -->
<?php
}
if ($hidden==1) // so the delete button is pressed
{
include 'config.php';
include 'opendb.php';
$query = "DELETE FROM user WHERE Id = '$ID'";
mysql_query($query) or die('Error, query failed');
include 'closedb.php';
?>
This user is deleted!!<br />
<form action = "<? echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="action" value="0">
<a href="registered.php">Back to registered users page</a>
</form>
<?php
}
if ($hidden==2) // so the update button is pressed
{
// some code here
?>
This user is updated!!<br />
<form action = "<? echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="hidden" value="0">
</form>
<?php
}
?>
in this way only the initial form and the delete work
so how could i set the hidden value to 2 :S
help !