简体   繁体   中英

PHP file doesn't run

I have this two files:
index.html

<html>
<body>

<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>

</body>
</html>

And welcome.php

<html>
<body>

Welcome, <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>

</body>
</html>


This is example from there

When the user fills the form and hits "enter" it should display:

Welcome, the_name_you_enter
Your email address is address_you_enter

But for me it only displays welcome.php source code (I am using Safari 7). Does anyone knows why?

听起来您是从未执行php的服务器上调出页面的。

This usually happens because the PHP file is not executed on a web server or PHP is not enabled on your webserver.

You are probably trying to access the file directly using file://

Take a look at MAMP (I am assuming you are using OS X)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM