input missing in mail sent by php

A

Anonymous

Guest
Hello,
I'm totally new to php, i've made a form on website and made a script by looking up in lessons and forums.
and it works i received the mail and the body text is shown but the input is missing. I really don't know
what's happening, i've echo the variables and they doesn't show.
Can anyone help me, i've been looking for days but don't find the answer. So i need help of php pro's

here is my code and html

html :

<form id="form" method="post" action="form_mailer.php" enctype="multipart/form-data" class="wpcf7-form">
<div class="contact-item field-full">
<textarea id="info" name="info" type="text" cols="40" rows="10" placeholder="info *"></textarea>
</div>
<div class="contact-item">
<input id="name" name="name" type="text" placeholder="Naam *" required>
</div>
<div class="contact-item">
<input id="email" name="email" type="email" placeholder="Email *"required>
</div>
<div class="contact-item">
<input id="website" name="website" type="text" placeholder="Website">
</div>
<div class="contact-item form-submit">
<input id="submit" name="submit" type="submit" formenctype="text/plain" formmethod="POST" title="invulformulier website" value="verstuur">
</div>
</form>

php code from form_mailer.php file

<?php
// Controle of een formulier gepost is
if($_SERVER['REQUEST_METHOD'] == 'POST')

echo "Naam = ".$_POST['name'];
echo "Email = ".$_POST['email'];
echo "Website = ".$_POST['website'];
echo "Info = ".$_POST['message'];
error_reporting(E_ALL);


/* These are the variable that tell the subject of the email and where the email will be sent.*/

// Een korte benaming voor jouw website
$website_name = 'www.webadres.be';
$emailSubject = 'website formulier';
$mailto = 'myemail@myemail.be';
// Een geldig emailadres voor errors
$error_emailadres = 'myemail@myemail';
// HTML mail? True/False
$html = true;

/* These will gather what the user has typed into the fieled. */

$infoField = $_POST['info'];
$nameField= $_POST['name'];
$emailField = $_POST['email'];
$websiteField = $_POST['website'];


/* This takes the information and lines it up the way you want it to be sent in the email. */

$body = <<<EOD
<br><hr><br>
Info : $infoField <br>
Name : $nameField <br>
Email : $emailField <br>
Website : $websiteField <br>
<br><hr><br>
EOD;

// De headers samenstellen
$headers = 'From: ' . $website_name . ' <' . $mailto . '>' . "\r\n";
$headers .= 'Reply-To: ' . $emailField . ' <' . $emailField . '>' . "\r\n";
$headers .= 'Return-Path: Mail-Error <' . $error_emailadres . '>' . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion() . "\r\n";
$headers .= 'X-Priority: Normal' . "\r\n";
$headers .= ($html) ? 'MIME-Version: 1.0' . "\r\n" : '';
$headers .= ($html) ? 'Content-type: text/html; charset=iso-8859-1' . "\r\n" : '';
$success = mail($mailto, $emailSubject, $body, $headers); // This tells the server what to send.


?>
<html>
<body>
Your message was successfully sent!<br />
<br />
Thank you for contacting us!

</body>

</html>

thx on advanced
 
Is this what is not being sent:
Code:
<textarea id="info" name="info" type="text" cols="40" rows="10" placeholder="info *"></textarea>
?

as this:
Code:
echo "Info = ".$_POST['message'];
might be the reason?

Also have a look at this to add some protection to your forms in a simple way.
 
Back
Top