How do I clear the data in the $_post?

Source: Internet
Author: User
Try to write a login interface, has not finished, testing the time to find problems. $_post value will not be emptied, each input user name, $_post inside more than one user name, the consequence is the first error input, you can no longer enter the correct user name ... Unless the browser refreshes the page ...

 
  
 
 
  
 <title>Welcome back</title>
 
 
Welcome back

Log in:

. error {color:red;}'; if ($_server[' Request_method ']== ' POST ') {$problem = false; $login = False;if (Empty ($_post[' user_name '])) {$problem = True;print '

Please enter your user name!

';} if (Empty ($_post[' password ')) {$problem = True;print '

Please enter a password

';} if (! $problem) {$user = Trim (stripslashes ($_post[' user_name ')), $pwd = Trim (stripslashes ($_post[' password ')); $user = Mysql_real_escape_string ($user); $pwd = mysql_real_escape_string ($pwd); $q = "SELECT * from user WHERE user_name = ' $user ' A nd PASSWORD = ' $pwd ', echo $q; $result = mysql_query ($q); if (! $result | | mysql_num_rows ($result) = = 0) {print '

Wrong Username or Password.

';} else{$row = mysql_fetch_array ($result), $id = $row [' user_id ']; $name = $row [' user_name '];echo ' USER ID is '. $id; session_ Start (); $_session[' $id '] = $id;//clear the POST array$_post = Array (); The way to find it online, but it doesn't seem to use}}else{print '

Please try Again!

';}}? >



Please help the master to solve, grateful


Reply to discussion (solution)

                            
Switch
                            
Can
Is the space in value and carriage return line break in mischief

PHP code?12345678Input Type=text is a single-line text editor
If you give him multiple lines of text, then only the first line can be edited. That's why you're having a problem.

Why is there such a thing???

=================================================

I'm here to study.

Maybe you have a problem with post assignment, the value of post will only overwrite the previous one, how can it be attached?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.