1 通过隐藏表单提交
//通过隐藏表单提交
if ($_POST['action'] == 'register'){
echo '你提交了数据';
exit();
}
?> <!DOCTYPE html>
<head>
</head>
<body>
<div id='register'>
<form method="post" name="register" action="register.php">
<input type="hidden" name="action" value="register" />
<ul>
<h2>请认真填写一下内容</h2>
<li>用 户 名:<input type='text' name='username' class='text' />(*必填,至少两位)</li>
<li>密  码:<input type='password' name='password' class='text' />(*必填,至少两位)</li>
<li><input type='submit' value='提交' /></li>
</ul>
</form>
</div>
</body>
2 通过?后的后缀提交数据
<?php
if ($_GET['action'] == 'register'){
echo '你提交了数据';
exit();
}
?> <!DOCTYPE html>
<head>
</head>
<body>
<div id='register'>
<form method="post" name="register" action="register.php?action=register">
<ul>
<h2>请认真填写一下内容</h2>
<li>用 户 名:<input type='text' name='username' class='text' />(*必填,至少两位)</li>
<li>密  码:<input type='password' name='password' class='text' />(*必填,至少两位)</li>
<li><input type='submit' value='提交' /></li>
</ul>
</form>
</div>
</body>