Heilmann
Heilmann

Reputation: 67

Can not output formdata in PHP

I am starting with PHP and read this page from w3schools: http://www.w3schools.com/php/php_forms.asp

There is a code example to enter your name and e-mail and below it there is another code example that can echo the inputs of the form. The problem is that my inputs are not displayed on the second page.

The code of the form:

    <!DOCTYPE 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>

The code of the output page (welcome.php):

    <html>
<body>

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

</body>
</html>

result when clicking submit button

Why are my inputs not displayed on the welcome page? Thank you for your help

11.02.2015

I have xampp and it should run fine enter image description here

I also put my sourcefile in the correct folder htdocs enter image description here

I followed this tutorial (its German sorry :( ) http://www.php-einfach.de/php-tutorial/php-erste-schritte.php

Do you know what am I missing?

Upvotes: 0

Views: 77

Answers (1)

Eko
Eko

Reputation: 443

you can't open PHP by double-click it like you are opening HTML files, it can't run on c:\ you should access it like http://localhost/test2/welcome.php

and you need PHP interpreter too.

Upvotes: 2

Related Questions