<> First design the format of the database :

1: stay test Create tables in the database :user( It can also be created elsewhere , Just aim at the right position )
2: establish username(varchar(30)),password(varchar(30))
<> register html code :(signup.html) <!doctype html> <html lang="en"> <head> <meta
charset="UTF-8"> <title> User registration page </title> </head> <body> <form action="signup.php"
method="post"> <p> user name :<input type="text" name="name"></p> <p> dense code : <input
type="text" name="password"></p> <p><input type="submit" name="submit"
value=" register "></p> </form> </body> </html>
PS:
lang="en" The role of :
This is a W3C Standards for ;lang Representative language ,en It's English ; Change to zh-cn Refers to simplified Chinese

<> register PHP code :(signup.php) <?php header("Content-Type: text/html; charset=utf8");
if(!isset($_POST['submit'])){ exit(" Error execution "); }// Judge whether there is submit operation
$name=$_POST['name'];//post Get the name
$password=$_POST['password'];//post Get the password
include('connect.php');// Linked database $q="insert into user(username,password) values
('$name','$password')";// Insert the value from the form into the database sql $reslut=mysql_query($q,$con);// implement sql
if (!$reslut){ die('Error: ' . mysql_error());// If sql Execution failed, output error }else{ echo
" login was successful ";// Success output registration success } mysql_close($con);// close database ?> PS: header("Content-Type:
text/html; charset=utf8"); The role of :
header("Content-type: text/html; charset=utf-8");
You can't output anything to the page before this sentence , It means it can't be used echo Etc , No output html Label or text , If header Before the output of the label or text, that will definitely report an error
You actually used it header("Content-type: text/html; charset=utf-8"); There is no need to use this sentence , The same truth <>
Sign in html code :(login.html) <!doctype html> <html lang="en"> <head> <meta
charset="UTF-8"> <title> land </title> </head> <body> <form name="login"
action="login.php" method="post"> <p> user name <input type=text name="name"></p> <p> dense
code <input type=password name="password"></p> <p><input type="submit"
name="submit" value=" Sign in "></p> </form> </body> </html> <> Sign in PHP code :(login.php)
<?PHP header("Content-Type: text/html; charset=utf8");
if(!isset($_POST["submit"])){ exit(" Error execution "); }// Check whether there is submit operation
include('connect.php');// Linked database $name = $_POST['name'];//post Get user name form value $passowrd
= $_POST['password'];//post Get user password value if ($name && $passowrd){// If the user name and password are not empty $sql
= "select * from user where username = '$name' and
password='$passowrd'";// Check whether the database has a corresponding username and password Of sql $result =
mysql_query($sql);// implement sql $rows=mysql_num_rows($result);// Returns a numeric value if($rows){//0
false 1 true header("refresh:0;url=welcome.html");// If successful jump to welcome.html page exit;
}else{ echo " Wrong user name or password "; echo " <script>
setTimeout(function(){window.location.href='login.html';},1000); </script>
";// If used incorrectly js 1 Seconds later, jump to the login page and try again , Let it input again } }else{// If the user name or password is empty echo " Incomplete form "; echo "
<script> setTimeout(function(){window.location.href='login.html';},1000);
</script>"; // If used incorrectly js 1 Seconds later, jump to the login page and try again , Let it input again } mysql_close();// close database ?> <>
Login successful html code :(welcome.html) <!doctype html> <html lang="en"> <head> <meta
charset="UTF-8"> <title> Successful landing </title> </head> <body> Welcome </body> </html> <>
Code for linking databases :(connect.php) <?php $server="localhost";// Host's IP address , You can also fill in 127.0.0.1
$db_username="root";// Database user name $db_password="root";// Database password $con =
mysql_connect($server,$db_username,$db_password);// Linked database if(!$con){ die("can't
connect".mysql_error());// If the link fails, an error is output }
mysql_select_db('test',$con);// Select database ( It has been said that it is test database ) ?>

Technology
©2020 ioDraw All rights reserved
Swing actual combat Understanding closure about vue in el-date-picker type=daterange The problem of date not echoing Ubuntu 18.04 swap Partition expansion Snake code --c Language Edition visual c++6.0 open 【Golang Basic series 10 】Go language On conditional sentences ifString class —— summary ,String The nature of , Memory resolution , Commonly used APIAdobe Illustrator Publish native support Apple Silicon Test version of the software study java My first class antd table sort