1、phptext.html
<html>
<head>
<title>
Entering data into text fields
</title>
</head>
<body>
<h1>
Entering data into text fields
</h1>
<form method="post" action="http://localhost:81/ch5/phptext.php">
What 's your name ?
<input name="data" type="text">
<input type="submit" value="Send">
</form>
</body>
</html>
2、phptext.php
<html>
<head>
<title>
Reading data into text fields
</title>
</head>
<body>
<h1>
Reading data into text fields
</h1>
Thanks for answering,
<?php
echo $_REQUEST["data"];
?>
</body>
</html>
因为PHP通过网站访问时需要加localhost:端口号/,所以在HTML<form>标签中action属性必须全面,如:action="http://localhost:81/ch5/phptext.php"
PHP从HTML表单获取数据action问题
最新推荐文章于 2022-05-01 15:46:57 发布