View Full Version: Problem Opening A PHP File From a HTML File

MPAM Rebooted Forums > Tutorials & help > Problem Opening A PHP File From a HTML File


Title: Problem Opening A PHP File From a HTML File
Description: Opening PHP file from HTML file


jrod11151979 - October 29, 2008 11:11 PM (GMT)
To anyone that can help,

I am using Apache and PHP 5.

I am new to this environment and think I am missing some sort of command for apache.

Basically I made a small HTML test document and in it has two forms. One for a Name, the other for any type of text information I type in. This information is then submitted to a PHP script.

The problem is when I press send the php document is opened as a text document in notepad. I did not save it as a .txt file, I saved it as a .php. I can open the document via internet explore by going typing the directory name directly but for some reason when the document is called from the HTML document it is opened as text.

Has anyone experienced this before and has fixed it?

The code is as follows:
<html>
<head>
<title>A Simple HTML Form</title>
</head>
<body>
<form action="send_simpleform.php" method="POST">
<p><strong>Name:</strong><br/>
<input type="text" name="user"/></p>
<p><strong>Message:</strong><br/>
<textarea name="message" rows="5" cols="40"></textarea></p>
<p><input type="submit" value="send"/></p>
</form>
</body>
</html>

<?php
echo "<p>Welcome <b>".$_POST["user"]."</b>!</p>";
echo "<p>Your message is: <br/><b>".$_POST["message]."</b></p>";
?>

Thanks for your help.


patheticcockroach - October 30, 2008 07:08 AM (GMT)
Hello,

Are you sure you did properly the part called "Configuring Apache to work with PHP" in the tutorial? Particularly the part where adding "AddType application/x-httpd-php .php" in php.ini.
Otherwise, does the problem occurs on other browser than MSIE? (Firefox, Opera...)

Regards,




Hosted for free by InvisionFree