Page 1 of 1

Problem Displaying PHP Page

Posted: Sat Feb 27, 2010 5:27 pm
by dwappes
I created a contact.php form and a send_contact.php script and uploaded them to the server. However, when I try to navigate to the contact.php page I get a popup window asking if I want to open or save the file. So, I changed the contact.php page to contact.html, which allowed me to arrive at the page, then when I clicked "submit" I again got a popup window asking if I wanted to open or save the file.

Does anyone have any idea why this is happening? Here is the contact form code, followed by the send_contact.php code.

Code: Select all

<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>
 
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="send_contact.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="16%">Subject</td>
<td width="2%">:</td>
<td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
</tr>
<tr>
<td>Detail</td>
<td>:</td>
<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td><input name="name" type="text" id="name" size="50"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>

Code: Select all

<?php
// Contact subject
$subject ="$subject";
// Details
$message="$detail";
 
// Mail of sender
$mail_from="$customer_mail";
// From
$header="from: $name <$mail_from>";
 
// Enter your email address
$to ='someone@somewhere.com';
 
$send_contact=mail($to,$subject,$message,$header);
 
// Check, if message sent to your email
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}
?>

Re: Problem Displaying PHP Page

Posted: Sat Feb 27, 2010 5:33 pm
by Darhazer
There is no handler for php scripts on your server. You have to contact your hosting provider. It's possible that they do not provide PHP at all.

Re: Problem Displaying PHP Page

Posted: Sat Feb 27, 2010 6:31 pm
by wiseoleweazel
I agree with the above, the server is seeing your request but has no way to display the information to you, the next step is to ask you to save the file so you can view it in another location that may have the php elements installed.

If this is a locally hosted server on your machine i think you need the php files for your server software. If it is hosted elsewhere contact the provider and ask them if they support php files on your account or at all.

Re: Problem Displaying PHP Page

Posted: Sat Feb 27, 2010 8:18 pm
by dwappes
Thanks!!