i have a problem with my session, if a client would succesfully fill up the form he would be directed into a success page but if he try to use the back button in the browser the form will clear up (which is i think is correct) but if he accidentaly input a wrong value in a field, the session automatically clears all form. i have jscript that validates the form.
here is my session on the form:
Code: Select all
$secret = md5(uniqid(mt_rand(), true));
$_SESSION['secret'] = $secret;
$message = (isset($_GET['error']) && $_GET['error'] != '') ? $_GET['error'] : '';
<input type="hidden" name="secret" value="<?php echo $secret; ?>" />Code: Select all
if (!isset($_POST['secret']))
if (($_SESSION['secret'] != $_POST['secret']) || (!isset($_SESSION['secret'])))
{
}
else
{
}