Guest User

Untitled

a guest
Sep 10th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. Showing message from php action script in form
  2. <div id="register_user_box" class="inline_form" style="position: absolute; top: 20px; right: 10px; <br/>
  3. <span id="user_msg"></span><br/>
  4. <form action="register_user.php" method="post">
  5. <input type="hidden" name="id" id="id" value="add" />
  6. <input type="hidden" name="edit_user" id="edit_user" value="y" />
  7. <table cellspacing="0px"> <tr><td>Username:</td></tr><tr><td>
  8. <input type="text" name="uname" size="30" value="" class="inline_input"/></td> </tr> <tr><td>Email:</td></tr><tr><td>
  9. <input type="text" name="uemail" size="30" value="" class="inline_input"/></td> </tr> <tr><td>Password:</td></tr><tr><td>
  10. <input type="password" name="upass" size="30" class="inline_input"/></td> </tr> <tr><td>Confirm Password:</td></tr><tr> <td>
  11. <input type="password" name="cpass" size="30" class="inline_input"/></td></tr> </table></td></tr> </table> <p>
  12. <input class="button" type="submit" name="register" value="Register" style="float:right;"/></p>
  13. </form>
  14. </div>
  15.  
  16. <?php
  17.  
  18. $messages = array( 'usr_cred_req' => 'Must specify username, email, password.',
  19. 'usr_name_bad' => 'Bad username selection. Select a different usrename.',
  20. 'usr_name_exists' => 'Username selected already exists. Select a different username.',
  21. 'usr_email_bad' => 'Bad email selection. Select a different email.',
  22. 'usr_email_exists' => 'Email selected already exists. Select a different email.',
  23. 'usr_pass_notmached' => 'Passwords do not match. Type passwords again.',
  24. 'usr_not_added' => 'User not added.',
  25. 'usr_not_updated' => 'User not updated.',
  26. 'usr_added' => 'User added.'
  27. );
  28.  
  29. $username = trim($_REQUEST['uname']);
  30. $email = trim($_REQUEST['uemail']);
  31. $password = md5(trim($_REQUEST['upass']));
  32. $copasswd = md5(trim($_REQUEST['cpass']));
  33.  
  34.  
  35. if ( $password != $copasswd ) { echo '<script> $("#usr_msg").html("'.$messages['usr_pass_notmached'].'"); </script>'; return;}
  36. ?>
  37.  
  38. if ( $password != $copasswd ) {
  39. $display_msg = $messages['usr_pass_notmached']
  40. }
  41.  
  42. <span><?php echo $display_msg?></span>
Add Comment
Please, Sign In to add comment