PHP form data acquisition code

高洛峰
Release: 2023-03-04 18:22:01
Original
1936 people have browsed it

<html> 
<head> 
<title>Form</title> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
</head> 

<body> 
<form action="post.php" method="get" name="form1"> 
<table width="271" border="0" align="center" cellpadding="0" cellspacing="0"> 
<tr> 
<td width="85"><div align="right">姓名:</div></td> 
<td width="186"><input name="username" type="text" id="username"></td> 
</tr> 
<tr> 
<td><div align="right">密码:</div></td> 
<td><input name="password" type="password" id="password"></td> 
</tr> 
<tr> 
<td><div align="right">密码确认:</div></td> 
<td><input name="password2" type="password" id="password2"></td> 
</tr> 
<tr> 
<td><div align="right">性别:</div></td> 
<td><select name="sex" id="sex"> 
<option value="0" selected>男</option> 
<option value="1">女</option> 
</select></td> 
</tr> 
<tr> 
<td><div align="right">生日:</div></td> 
<td><input name="birthday" type="text" id="birthday"></td> 
</tr> 
<tr> 
<td><div align="right">E-mail:</div></td> 
<td><input name="email" type="text" id="email"></td> 
</tr> 
<tr> 
<td><div align="right">职业:</div></td> 
<td><input name="job" type="text" id="job"></td> 
</tr> 
</table> 
<p align="center"> 
<input type="submit" value="Submit"> 
<input type="reset" value="Reset"> 
</p> 
</form> 
</body> 
</html>
Copy after login
<?php 
//本程序用于接收来自HTML页面的表单数据,并输出每个字段 
echo "用户的输入如下所示:<BR>"; 
echo "姓名:".$_GET[&#39;username&#39;]."<BR>"; 
echo "密码:".$_GET[&#39;password&#39;]."<BR>"; 
echo "密码确认:".$_GET[&#39;password2&#39;]."<BR>"; 
echo "性别:".$_GET[&#39;sex&#39;]."<BR>"; 
echo "生日:".$_GET[&#39;birthday&#39;]."<BR>"; 
echo "E-mail:".$_GET[&#39;email&#39;]."<BR>"; 
echo "职业:".$_GET[&#39;job&#39;]."<BR>"; 
?>
Copy after login
<?php 
//本程序用于接收来自HTML页面的表单数据,并输出每个字段 
echo "用户的输入如下所示:<BR>"; 
echo "姓名:".$_POST[&#39;username&#39;]."<BR>"; 
echo "密码:".$_POST[&#39;password&#39;]."<BR>"; 
echo "密码确认:".$_POST[&#39;password2&#39;]."<BR>"; 
echo "性别:".$_POST[&#39;sex&#39;]."<BR>"; 
echo "生日:".$_POST[&#39;birthday&#39;]."<BR>"; 
echo "E-mail:".$_POST[&#39;email&#39;]."<BR>"; 
echo "职业:".$_POST[&#39;job&#39;]."<BR>"; 
?>
Copy after login

For more articles related to the PHP form data acquisition code, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template