A basic knowledge form submission for PHP

  • 2020-05-09 18:17:53
  • OfStack

register.php:
 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html;charset=gb2312"> 
<title> The sign-up page </title> 
</head> 
<body> 
<form action="request.php" method="post" name="registForm"> 
<table width="330" border="0" align="center" cellpadding="5" bgcolor="#eeeeee"> 
<tr> 
<td width="40%"> The user name :</td> 
<td><input name="username" type="text" id="username"/></td> 
</tr> 
<tr> 
<td> The name :</td> 
<td><input name="name" type="text" id="name"/></td> 
</tr> 
<tr> 
<td> password :</td> 
<td><input name="pwd" type="text" id="pwd"/></td> 
</tr> 
<tr> 
<td> email :</td> 
<td><input name="email" type="text" id="email"/></td> 
</tr> 
<tr> 
<td colspan="2" align="center"> 
<input type="submit" value=" submit " name="submit"/> 
<input type="reset" value=" reset " name="button"/> 
</td> 
</tr> 
</table> 
</form> 
</body> 
</html> 

request.php
 
<?php 
$username = $_POST['username']; 
$name = $_POST['name']; 
$pwd = $_POST['pwd']; 
$email = $_POST['email']; 
//print_r($username); 
if(!empty($username)) 
{ 
echo " The information you filled in is: <br>\n"; 
echo " The user name : $username <br>\n"; 
echo " Name:  $name <br>\n"; 
echo " password : $pwd <br>\n"; 
echo " email : $email <br>\n"; 
} 
print_r($_POST) 
//echo "aaaa"; 
?> 
</PRE> 
</DIV> 

Of course, you can also write request and regiser.php as 1.

Related articles: