Pages

Tuesday, June 15, 2010

How to redirect Back to previous page PHP

Put this in your code:



that is a javascript code.


As for me, I embedded it to my php file like this:

if(!checkEverything()){ // a function that contains checking of fields.
SCRIPT HERE* //redirects Back to the previous page with values still in the form
    }else{
    displayAll(); // a function that displays all
}


Note: I cannot add the script as it is because blogspot reads the script and the effect is redirecting you to your previous page. As an alternative I put it as image :)

Hope this helps. It worked 100% for me :)