I am stumped! php does not echo on localhost
Posted: 03. June 2014 06:12
I just installed the latest version of XAMPP on Win 7 64bit, have made no changes beyond the security recomended changes.
The XAMPP Control Panel is working with both Apache and MySQL running.
From https://community.apachefriends.org/f/viewtopic.php?f=16&t=68213&p=234390&hilit=echo+working#p234390, I copied the code:
and it runs as it should:
I copied a bit more complicated code from the w3schools.com site http://www.w3schools.com/php/php_forms.asp:
The html file welcome.html:
And the php file welcome.php:
On the site test area this gives:
When I copied these files directly to my htdocs and run it I get:
The php echo statements simply do not work!
This was the reason for installing the XAMPP update, I assumed something in the current install had been damaged somehow.
That apparently was not the case...
If I had written this code I would assume it had an error, but their code works on the web site, but not in the localhost...
This has got me totally stumped - anyone have any ideas?
The XAMPP Control Panel is working with both Apache and MySQL running.
From https://community.apachefriends.org/f/viewtopic.php?f=16&t=68213&p=234390&hilit=echo+working#p234390, I copied the code:
- Code: Select all
<?php
echo "This is a test for php.";
?>
and it runs as it should:
This is a test for php.
I copied a bit more complicated code from the w3schools.com site http://www.w3schools.com/php/php_forms.asp:
The html file welcome.html:
- Code: Select all
<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 the php file welcome.php:
- Code: Select all
<html>
<body>
Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>
</body>
</html>
On the site test area this gives:
When I copied these files directly to my htdocs and run it I get:
Welcome
Your email address is:
The php echo statements simply do not work!
This was the reason for installing the XAMPP update, I assumed something in the current install had been damaged somehow.
That apparently was not the case...
If I had written this code I would assume it had an error, but their code works on the web site, but not in the localhost...
This has got me totally stumped - anyone have any ideas?