The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> HTML/PHP Contact Form not working
joanan
post Aug 3 2011, 11:58 AM
Post #1





Group: Members
Posts: 1
Joined: 3-August 11
Member No.: 15,073



Good afternoon,

I've got a problem with a Contact Form that doesn't work in two ways:
- I get no messages on my email box (I tried several times filling the form and hitting the submit button)
- After hitting the submit button a weird page with code shows up

Can you help me figure this out?
Thank you,
Joana


The mentioned contact form is currently located online on this url: http://www.psikairos.com/contactos.html


I'll copy and paste the code anyway:

the PHP file (named mailer.php)

CODE

<?PHP
$to = "joanasnascimento@gmail.com";
$subject = "Results from your Request Info form";
$headers = "From: Form Mailer";
$forward = 0;
$location = "";

$date = date ("l, F jS, Y");
$time = date ("h:i A");



$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";

if ($_SERVER['REQUEST_METHOD'] == "POST") {
    foreach ($_POST as $key => $value) {
        $msg .= ucfirst ($key) ." : ". $value . "\n";
    }
}
else {
    foreach ($_GET as $key => $value) {
        $msg .= ucfirst ($key) ." : ". $value . "\n";
    }
}

mail($to, $subject, $msg, $headers);
if ($forward == 1) {
    header ("Location:$location");
}
else {
    echo "Thank you for submitting our form. We will get back to you as soon as possible.";
}

?>



The HTML code

CODE

<form action="mailer.php" method="post">
Nome:<br />
<input type="text" name="test"><br><br />
Email:<br />
<input type="text" name="email"><br><br /><br />
Mensagem:<br> <textarea name="message" rows="10" cols="50"></textarea><br><br />
<input type="submit" name="submit" value="Enviar">
</form>



Thank you again,
Joana
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Aug 3 2011, 12:08 PM
Post #2


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



What you are getting back is just the php program (mailer.php). So you need to have php enabled, probably by making the right settings in .htaccess. Try the help information for your hosting service.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th April 2024 - 08:23 AM