0
votes

I'm studying PHP (so I'm a rookie). I'm working on a PC (windows 7) with XAMPP, Apache.

I have two files exampleform.html:

<html>
<body>

<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>

</body>
</html>

and welcome.php:

<html>
<body>

Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.

</body>
</html>

I created those 2 files and worked well. On Monday I encountered the problem that upon clicking the buttom summit query it would show me the code instead the result. I searched few forums and found I need to add the following lines to httpd.conf (xampp/apache/conf/):

AddType application/x-httpd-php-source .phps

AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml .php

Then it worked. Today when I try again it shows me the code once more. Please help. It can't be so complicated!

2
Are you sure your server is running when you try and run the code?Tim Ackroyd
Yes I can see it is running in XAMPP Control Paneluser1411551

2 Answers

0
votes

Is your changes of httpd.conf being inverted? if so, try put them back and restart your apache. If not, then check for your httpd.conf file, make sure php5 module is loaded, you should look for a line look similar like this one:

LoadModule php5_module libexec/apache2/libphp5.so

0
votes

I don't know about XAMPP, but it seems that it overwrites the config file whenever you restart your server (ie. restart Windows).

Try installing WAMP instead, which was made for Windows in the first place.