Help - Search - Members - Calendar
Full Version: HTML/PHP Contact Form not working
HTMLHelp Forums > Programming > Server-side Scripting
joanan
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
Brian Chandler
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.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.