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 & gt; & lt; body & gt; & lt ;? Phpif (! Empty ($ _ POST [submit]) {& nbs wrote a simple registration page. you can fill out the form and click submit. the page does not respond.
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.