[英]html form with Php code not executing
I'm new to PHP. 我是PHP新手。 I have this html file with php in it:
我有这个带有php的html文件:
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>Php torturail 1</title>
</head>
<body>
<p>php ahead:</p>
<?php
if (isset($_POST['submit'])){
printf('User Name: %s', $_POST['name']);
}
?>
<form method="post" action="">
<p>name:</p>
<input type="text" name="name">
<p>pass:</p>
<input type="password" name="pwd">
<p>massage:</p>
<textarea name="area"></textarea>
<p>accept:</p>
<input type="checkbox" name="chb" value="on">
<p>lucky number:</p>
<input type="radio" name="group1" value="option1">1
<input type="radio" name="group1" value="option2">2
<p>button:</p>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
When I open it on on a browser and click submit, the form's fileds are empty again but nothing is printed. 当我在浏览器中打开它并单击提交时,表单的文件再次为空,但未打印任何内容。
What is the problem? 问题是什么?
Thank you. 谢谢。
2 things: 1-you must save your file as .php file. 2件事情:1-您必须将文件另存为.php文件。 2-fill action in your form tag
表单标签中的2填充操作
<form method="post" action="where.php">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.