Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Showing message from php action script in form
- <div id="register_user_box" class="inline_form" style="position: absolute; top: 20px; right: 10px; <br/>
- <span id="user_msg"></span><br/>
- <form action="register_user.php" method="post">
- <input type="hidden" name="id" id="id" value="add" />
- <input type="hidden" name="edit_user" id="edit_user" value="y" />
- <table cellspacing="0px"> <tr><td>Username:</td></tr><tr><td>
- <input type="text" name="uname" size="30" value="" class="inline_input"/></td> </tr> <tr><td>Email:</td></tr><tr><td>
- <input type="text" name="uemail" size="30" value="" class="inline_input"/></td> </tr> <tr><td>Password:</td></tr><tr><td>
- <input type="password" name="upass" size="30" class="inline_input"/></td> </tr> <tr><td>Confirm Password:</td></tr><tr> <td>
- <input type="password" name="cpass" size="30" class="inline_input"/></td></tr> </table></td></tr> </table> <p>
- <input class="button" type="submit" name="register" value="Register" style="float:right;"/></p>
- </form>
- </div>
- <?php
- $messages = array( 'usr_cred_req' => 'Must specify username, email, password.',
- 'usr_name_bad' => 'Bad username selection. Select a different usrename.',
- 'usr_name_exists' => 'Username selected already exists. Select a different username.',
- 'usr_email_bad' => 'Bad email selection. Select a different email.',
- 'usr_email_exists' => 'Email selected already exists. Select a different email.',
- 'usr_pass_notmached' => 'Passwords do not match. Type passwords again.',
- 'usr_not_added' => 'User not added.',
- 'usr_not_updated' => 'User not updated.',
- 'usr_added' => 'User added.'
- );
- $username = trim($_REQUEST['uname']);
- $email = trim($_REQUEST['uemail']);
- $password = md5(trim($_REQUEST['upass']));
- $copasswd = md5(trim($_REQUEST['cpass']));
- if ( $password != $copasswd ) { echo '<script> $("#usr_msg").html("'.$messages['usr_pass_notmached'].'"); </script>'; return;}
- ?>
- if ( $password != $copasswd ) {
- $display_msg = $messages['usr_pass_notmached']
- }
- <span><?php echo $display_msg?></span>
Add Comment
Please, Sign In to add comment