A simple registration page is written. you can fill out the form and click Submit. no solution is displayed on the page.

Source: Internet
Author: User
A simple registration page is written. you can fill out the form and click Submit. the page does not respond and you click Submit. the page does not respond to the code: & lt; html & gt; & lt; head & gt; & lt; title & gt; registerpage & lt;/title & gt; & lt;/head writes a simple registration page. after entering the form, click submit, page no response
After filling out the form and clicking submit, the page does not respond
Code:


Register page


If (! Empty ($ _ POST ['submit '])
{
$ Username = $ _ POST ['username'];
$ Password = $ _ POST ['password'];
$ Verify_ps = $ _ POST ['verify _ PS'];
$ Email = $ _ POST ['email '];
$ Qq =$ _ POST ['QQ'];
}
If (! Isset ($ _ POST ['username'], $ _ POST ['password'], $ _ POST ['verify _ PS'], $ _ POST ['email '])
{
?>

}
Else {
$ Mysql = new mysqli ('localhost', 'webuser', '123 ');
If (! $ Mysql)
{
Echo "can't connect to db .";
Exit;
}
$ Select = $ mysql-> select_db ('user', $ mysql); // you can specify the currently activated database associated with the link identifier ($ mysql ).
If (empty ($ select ))
{
Die ("can't select to db .");
}
$ S_username = "select name = '". $ username. "' from picuser ";
$ S_email = "select e_mail = '". $ email. "' from picuser ";
$ Name_result = $ mysql-> query ($ s_username );
$ Email_result = $ mysql-> query ($ s_email );
$ N_row = $ name_result-> fetch_row ();
$ E_row = $ email_result-> fetch_row ();
If ($ n_row | $ e_row ){
Echo "this username has been registered .";
Exit;
}
$ Insert_user = "insert into picuser (name, password, e_mail, qq) values ('". $ username. "','". $ password. "','". $ email. "','". $ qq. "')";
$ Insert_result = $ mysql-> query ($ insert_user );
If ($ insert_result)
{
Die ('Insert data is fail .');
} Else {
Echo "you has registered successful! ";
}
}
?>



------ Solution --------------------
Standardized form writing.

------ Solution --------------------
Isn't it better to separate forms from PHP? Label with P? Is it meaningful to use teble!
------ Solution --------------------
A little long. it is better to separate html from php.

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.