| | |
prevent user from going back or disable submit
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2008
Posts: 92
Reputation:
Solved Threads: 15
I don't think you can stop a user going back if he wishes by simply clicking on the browser back button.
What you can do instead is to set session variables as he visits each stage. If he resubmits a page that has it's session variable already set then you can indicate your preferred error message (using php).
example
Put this at the top of the script doing the validation.
Hope it helps!!!
What you can do instead is to set session variables as he visits each stage. If he resubmits a page that has it's session variable already set then you can indicate your preferred error message (using php).
example
php Syntax (Toggle Plain Text)
<?php if($_SESSION['user_details_form_submitted']==1){ echo "You are not allowed to resubmit!!"; exit(); } ?>
Hope it helps!!!
•
•
Join Date: May 2008
Posts: 92
Reputation:
Solved Threads: 15
Yes you!! can put PHP into javascript but PHP will be executed first and thus it will only print whatever you have specified into the javascript code. Like in this example:
Note that this must be placed inline. It cannot be placed in an external javscript file!!
php Syntax (Toggle Plain Text)
<?php $myname="ronaldinho gaucho"; ?>
javascript Syntax (Toggle Plain Text)
<script type="text/javascript"> function showMyName() { alert("My name is "+<?php echo "\"".$myname."\""; ?>); } </script>
html Syntax (Toggle Plain Text)
<body onload="showMyName()"> </body>
![]() |
Similar Threads
- how to prevent user close window during script execution? (Shell Scripting)
- How to disable brouser back. (PHP)
- To disable Submit button (PHP)
- Access deny for backward (ASP.NET)
- "User Names" have disappeared from Welcome screen. (Windows NT / 2000 / XP)
- Prevent subsequent submits after initial submit (HTML and CSS)
- Prevent a User From Running or Stopping a Scheduled Process in Windows XP (Windows tips 'n' tweaks)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: php within echo statement / hide element
- Next Thread: Redirecting user to a login page
| Thread Tools | Search this Thread |
ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child close column createrange() css cursor date debugger dependent disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe images internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl math media microsoft mimic object onmouseoutdivproblem onreadystatechange parent paypal pdf php player position post problem programming progressbar regex runtime scriptlets scroll search security select shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n





