Hi, so I have a form in my HTML script that should be posting to send_form_email.php, however, all the form data will not pass through into the PHP; when I echo the values, they’re all displayed as blank.
HTML Form:
<form class="col s12 m6" method="post" action="send_form_email.php">
<div class="row">
<div class="input-field col s6">
<input name="first_name" id="first_name" type="text" class="validate">
<label for="first_name">First Name</label>
</div>
<div class="input-field col s6">
<input name="last_name" id="last_name" type="text" class="validate">
<label for="last_name">Last Name</label>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<input name="email" id="email" type="email" class="validate">
<label for="email">Email</label>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<input name="subject" id="subject" type="text" class="validate">
<label for="subject">Subject</label>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<textarea name="message" id="message" class="materialize-textarea"></textarea>
<label for="message">Message</label>
</div>
</div>
<button class="btn waves-effect waves-light studioblue" type="submit" name="submit">Submit
<i class="material-icons right">send</i>
</button>
</form>
And the PHP:
[php]
<?php $EmailTo = "[email protected]"; $FName = $_POST['first_name']; $LName = $_POST['last_name']; $Email = $_POST['email']; $Message = $_POST['message']; $Subject = $_POST['subject']; $Submitted = $_POST['submit']; // validation $validationOK=true; echo $Submitted; if (!$Submitted) { //$validationOK=false; } if (!$validationOK) { print ""; exit; } // All of these except EmailTo are blank. echo $EmailTo; echo $FName; echo $LName; echo $Email; echo $Message; echo $Subject; $Body = ""; $Body .= "First name: "; $Body .= $FName; $Body .= "\n"; $Body .= "Last name: "; $Body .= $LName; $Body .= "\n"; $Body .= "Email: "; $Body .= $email; $Body .= "\n"; $Body .= "Message: "; $Body .= $message; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$Email>"); // redirects temporarily disabled for testing if ($success){ //print ""; } else{ // print ""; } ?>[/php]