javascript - Avoid the form submission when user press f5 to refresh (no redirect) -


i see several post mine little different.

i send form same page , stuff on beginning of page , then, if it's ok, display "it's ok".

if(isset($_post['solo'])){     $j1 = $_session['u_pseudo'];     $pt1 = getpost_variable('pt1');     $j2 = getpost_variable('j2');     $pt2 = getpost_variable('pt2');     unset($_post); //trying avoid refresh     if($pt1 == $pt2){         $type = 0;         $error = 'scores need same !';     }     elseif($pt1 != 10 && $pt2 != 10){         $type = 0;         $error = 'one of both score need @ 10 !';     }     else {         $type = 1;         $error = 'success !;         add_match_solo($j1,$pt1,$j2,$pt2);            } 

and use var $type , $error display error.

so need avoid refresh keep variable $error , $type

thanks in advance^^

edit: avoid $_get when using redirect if it's choice...

you can jquery. code below disable ctrl+r , f5 not prevent refresh button on browser

function disablef5(e) { if ((e.which || e.keycode) == 116 || (e.which || e.keycode) == 82) e.preventdefault(); }; 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -