当我尝试表单数据,此代码转移到PHP文件:为什么我不能从形式带到PHP文件
的index.html(形式):
<!DOCTYPE html>
<html>
<body>
<form action="welcome.php" method="post">
First name:<br>
<input type="text" name="fname" value="Mickey">
<br>
Last name:<br>
<input type="text" name="lname" value="Mouse">
<br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
和的welcome.php是:
<!DOCTYPE html>
<html>
<body>
Welcome <?php echo $_POST["fname"]; ?><br>
Your email address is: <?php echo $_POST["lname"]; ?>
</body>
</html>
当我按下提交按钮,我得到了 “的welcome.php” 内容回:
为什么呢?我怎么修复它?
如果您将.php文件用作.html文件,为什么会有.php文件? –
@AdamBuchananSmith该文件中有两个php标记... – arkascha
看起来像你的http服务器不会解释php文件,因为它应该。这是你的配置问题。 – arkascha