You need to use cookies both in javascript and php
<?
if ($_COOKIE['pagename_displayed']==0) //if page is not displayed then only execute
{
//insert,update, statement
//this portion will only exeucte once, it will not execute on F5, when user submit form then we manual set cookie to 0 and then only this portion will execute. Also learn cookies in javascript following javascript code is just a place holder.
}
?>
<html>
<script language=javascript>
function submit()
{
//reset cookie meansm, page is not displayed
setcookie('pagename_displayed',0);
/*setcookie is not inbuild javascript function you need to create function after learing handling cookies in javascript*/
docuent.frm.submit();
}
</script>
<body>
<form>
<input>....................
</form>
</body>
<script language=javascript>
setcookie('pagename_displayed',1);//we are setting page is displayed
</script>
</html>
urt
Help yourself by helping someone.
|