905.532.9642 FREE project estimate within 24 hours
Problem
<?
session_start
();
/*Set session variable that will be used
for checking if form is actually submitted*/
$_SESSION
[
"resubmitForm"
]=(empty(
$_SESSION
[
"resubmitForm"
]))?
"1"
:
$_SESSION
[
"resubmitForm"
];
if(!empty(
$_POST
[
"process"
]) &&
!empty(
$_POST
[
"resubmitFormValue"
]) &&
$_SESSION
[
"resubmitForm"
]==
$_POST
[
"resubmitFormValue"
])
{
$_SESSION
[
"resubmitForm"
]++;
//Other needed actions
}
?>
<form id="form1" name="form1" action="" method="post">
<input type="hidden" name="process" id="process" value="1">
<input type="hidden" name="resubmitFormValue" id="resubmitFormValue" value="
<?=$_SESSION
[
"resubmitForm"
]
?>
" />
<input type="submit" name="Submit" value="Submit" />
</form>
Michael Pankratov
Associated tags: Web Development, Forms, HTML, PHP, Webpage, Sessions, Input Comments:
By using CAPTCHA in the form, you will fix this problem as well, because each time page loaded new CAPTCHA is created, and text entered in previous submission won’t be valid.
To find out what is CAPTCHA click here
To see how to implement CAPTCHA using PHP click here