Jump to content

Archived

This topic is now archived and is closed to further replies.

kacieh80

E-mail form downloading php file on submit rather than running script

Recommended Posts

hi, I am new to php, very new, i found a script and tweaked it for my liking on this page

windsor.txkweb.com/contact.html

works great, i took the same script only i took out all references to the phone, and i took the same form without the phone part and put it up on this site (in the bottom right hand corner)

www.literacycouncil.info

and when you submit on this one, it prompts to download the script rather than running the script

could it be my error...i can't see where i am wrong because its exactly the same as the other site accept the phone stuff, or could it be that the ftp site is just not set up for php, if so how do i set it up for php?

please help

Share this post


Link to post
Share on other sites
<?php
if(isset($_POST['submit'])) {
$to = "supersssweety@yahoo.com";
$subject = "Website Form Contact";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
 
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
 

mail($to, $subject, $body);
} else {
echo "There has been a problem in processing your request";
}

?>

<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=thankyou.html">
</head>
</html>

this is the one that won't work

Share this post


Link to post
Share on other sites
haha sorry...here is the form return validate() is java script at the top...its on both sites, and it works on this one, just the php won't work for the literacy council...don't you have to set the server up to run php? I can't get into any of those files, I emailed the guy that runs the server, but again, it may not be that 

<form method="POST" name= "form" action="mailer.php" onSubmit="return validate()">
                  <h6 align="left">Name:</h6>
                  &nbsp;&nbsp;<input type="text" name="name" size="12">
                  <h6 align="left">E-mail:</h6>           
                  &nbsp;&nbsp;<input type="text" name="email" size="12">
                  <h6 align="left">Message:</h6>
                  &nbsp;&nbsp;<textarea rows="4" name="message" cols="12"></textarea>
                  <br>
                  <br>
                  &nbsp;&nbsp;<input type="submit" value="Submit" name="submit">                         
                </form> 

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.