PHP的一个基础知识 表单提交
作者:bea
register.php: 代码如下: <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=gb2312"> <title>注册页面</title> </head> <body> <form action="request.php" method="post" name="re
register.php:
代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<title>注册页面</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%">用户名:</td>
<td><input name="username" type="text" id="username"/></td>
</tr>
<tr>
<td>姓名:</td>
<td><input name="name" type="text" id="name"/></td>
</tr>
<tr>
<td>密码:</td>
<td><input name="pwd" type="text" id="pwd"/></td>
</tr>
<tr>
<td>邮箱:</td>
<td><input name="email" type="text" id="email"/></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="提交" name="submit"/>
<input type="reset" value="重置" 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 "您填写的信息为:<br>
";
echo "用户名: $username <br>
";
echo "姓名: $name <br>
";
echo "密码: $pwd <br>
";
echo "邮箱: $email <br>
";
}
print_r($_POST)
//echo "aaaa";
?>
</PRE>
</DIV>
当然,你也可以把request跟regiser.php写到一起。
有用 | 无用
代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<title>注册页面</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%">用户名:</td>
<td><input name="username" type="text" id="username"/></td>
</tr>
<tr>
<td>姓名:</td>
<td><input name="name" type="text" id="name"/></td>
</tr>
<tr>
<td>密码:</td>
<td><input name="pwd" type="text" id="pwd"/></td>
</tr>
<tr>
<td>邮箱:</td>
<td><input name="email" type="text" id="email"/></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="提交" name="submit"/>
<input type="reset" value="重置" 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 "您填写的信息为:<br>
";
echo "用户名: $username <br>
";
echo "姓名: $name <br>
";
echo "密码: $pwd <br>
";
echo "邮箱: $email <br>
";
}
print_r($_POST)
//echo "aaaa";
?>
</PRE>
</DIV>
当然,你也可以把request跟regiser.php写到一起。
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- php入门学习知识点七 PHP函数的基本应用
- php入门学习知识点六 PHP文件的读写操作代码
- php入门学习知识点五 关于php数组的几个基本操作
- php入门学习知识点四 PHP正则表达式基本应用
- php入门学习知识点三 PHP上传
- php入门学习知识点二 PHP简单的分页过程与原理
- php入门学习知识点一 PHP与MYSql连接与查询
- php自定义函数call_user_func和call_user_func_array详解
- PHP 获取MySQL数据库里所有表的实现代码
- PHP setcookie设置Cookie用法(及设置无效的问题)
- php中使用explode查找某个字符是否存在的方法
- php array_push()数组函数:将一个或多个单元压入数组的末尾(入栈)
- php array_pop()数组函数将数组最后一个单元弹出(出栈)
- php array_map()数组函数使用说明
- php array_walk() 数组函数
- 7个超级实用的PHP代码片段
- php函数的常用方法及注意之处小结
- PHP 数据结构 算法描述 冒泡排序 bubble sort
- PHP中获取变量的变量名的一段代码的bug分析