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
Reply

Join Date: Jun 2008
Posts: 185
Reputation: aashishn86 is an unknown quantity at this point 
Solved Threads: 9
aashishn86's Avatar
aashishn86 aashishn86 is offline Offline
Junior Poster

Re: prevent user from going back or disable submit

 
0
  #11
Jul 2nd, 2009
rEaLITy iS aN iLLUSIOn cAUSED bY lACk oF aLCOHOL....
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 185
Reputation: aashishn86 is an unknown quantity at this point 
Solved Threads: 9
aashishn86's Avatar
aashishn86 aashishn86 is offline Offline
Junior Poster

Re: prevent user from going back or disable submit

 
0
  #12
Jul 2nd, 2009
i jus realised my form acts weird too when i try the same....
please share the solution if you find one ...
rEaLITy iS aN iLLUSIOn cAUSED bY lACk oF aLCOHOL....
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 92
Reputation: sureronald is an unknown quantity at this point 
Solved Threads: 15
sureronald sureronald is offline Offline
Junior Poster in Training

Re: prevent user from going back or disable submit

 
0
  #13
Jul 2nd, 2009
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
  1. <?php
  2. if($_SESSION['user_details_form_submitted']==1){
  3. echo "You are not allowed to resubmit!!";
  4. exit();
  5. }
  6. ?>
Put this at the top of the script doing the validation.
Hope it helps!!!
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 12
Reputation: itnagusak is an unknown quantity at this point 
Solved Threads: 0
itnagusak itnagusak is offline Offline
Newbie Poster

Re: prevent user from going back or disable submit

 
0
  #14
Jul 3rd, 2009
can i put php inside javascript?
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 185
Reputation: aashishn86 is an unknown quantity at this point 
Solved Threads: 9
aashishn86's Avatar
aashishn86 aashishn86 is offline Offline
Junior Poster

Re: prevent user from going back or disable submit

 
0
  #15
Jul 3rd, 2009
nopes....
u write javascript in the script tags...
and all u can do is call functions from the body...

what are you trying to do ?
rEaLITy iS aN iLLUSIOn cAUSED bY lACk oF aLCOHOL....
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 92
Reputation: sureronald is an unknown quantity at this point 
Solved Threads: 15
sureronald sureronald is offline Offline
Junior Poster in Training

Re: prevent user from going back or disable submit

 
0
  #16
Jul 3rd, 2009
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:

  1. <?php
  2. $myname="ronaldinho gaucho";
  3. ?>
  1. <script type="text/javascript">
  2. function showMyName()
  3. {
  4. alert("My name is "+<?php echo "\"".$myname."\""; ?>);
  5. }
  6. </script>
  1. <body onload="showMyName()">
  2. </body>
Note that this must be placed inline. It cannot be placed in an external javscript file!!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC