0

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?

5
  • what web server are you running? xampp? wamp? Commented Apr 6, 2014 at 11:33
  • Are you running this in an environment where PHP is available to you? Commented Apr 6, 2014 at 11:33
  • Nothing to do with the browser but it sounds like your web server is not running - are you running this on localhost? This is not really a programming question - it's more of an environmental one. Commented Apr 6, 2014 at 11:33
  • The files are on my computer - its why it doesn't run? Commented Apr 6, 2014 at 11:36
  • @nicael Yes - to run PHP you need a web server with the PHP executeable. XAMPP/WAMP on windows work fine if you want to run it on localhost. MAMP is good for OS X. Commented Apr 6, 2014 at 11:38

2 Answers 2

2

It sounds like your calling up the page from a server that is not executing php.

Sign up to request clarification or add additional context in comments.

Comments

1

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)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.