Page Setup code:
<! DOCTYPEHtml>
lang="EN">
<metacharset="UTF-8">
<title>title</title>
<body>
<formaction="Register_post.php"Method="POST">
<table>
<tr>
<td> User name:</td>
<td><inputType="Text"Name="Uname"Placeholder="Please enter your account"></td>
</tr>
<tr>
<td> Password:</td>
<td><input type="password" name="Pwod" placeholder="Please enter password"></td>
</tr>
</table>
<input type="Submit" value="registration">
</form>
</body>
Registration Process Page Code:
<?php
/**
* Created by XX.
* User:msi
* DATE:2017/10/24
* time:11:00
*/
Header"Content-type:text/html; Charset=utf-8 ");
Introduce the previous Dbda method set file
Require_once".. /dbda.class.php ";
$db=NewDbda ();
Var_dump ($_post);
If(!Empty($_post)) {
$uname=$_post["Uname"];
Queries whether the user name registered by the user is duplicated with the existing user name in the database and returns the query results;
$sql="SELECT * from t_user WHERE uname = '{$uname}‘";
Echo $sql;
$result=$db-Strquery($sql);
//}
If($result!="0") {
Exit("User name is occupied");
}Else{
$sql _insert=Insert into T_user (UNAME,PWOD) VALUES ('{$_post["Uname"]}‘,‘{$_post["Pwod"]}‘)";
Echo$sql _insert;
$result 2=$db-Query($sql _insert,0);
Var_dump ($result 2);
}
}
echo "Zhang San";
echo $_post[' uname '];
echo $_post[' Pwod '];
?>
<! DOCTYPE html>
< HTML lang= "en" >
Span style= "COLOR: #e8bf6a" > <meta Charset= "UTF-8" >
<title>title</title>
<BODY>
</body>,
</HTML>
< Span style= "COLOR: #e8bf6a" > < Span style= "COLOR: #a5c261" > < Span style= "COLOR: #bababa" > < Span style= "COLOR: #e8bf6a" > this is done!
Php+mysql Page Registration code