实例代码如下:
<html>
<head>
<title>php表单提交给本页的实例(http://www.manongjc.com)- 码农教程</title>
</head>
<body>
<div>
<?php
if ( ! empty( $_POST['guess'] ) ) {
print "last guess: ".$_POST['guess'];
}
?>
<form method="post" action="<?php print $_SERVER['PHP_SELF']?>">
<p>
Type your guess here: <input type="text" name="guess" />
</p>
</form>
</div>
</body>
</html>
这里的action设置为$_SERVER['PHP_SELF'];即表示本页,大家可以了解一下php $_SERVER 服务器环境信息
原文地址:http://www.manongjc.com/article/999.html
其他阅读:
css margin:0 auto无法居中的原因 php session_id()获取或设置Session会话ID php session_encode与session_decode函数使用实例 php如何保存cookie登录状态的安全性 php设置cookie过期时间