dimanche 1 décembre 2019

HTML/PHP Contact Form Sending Message but no Name/Email is showing

Alrighty, so I've been working on an "application" form that you can fill out and submit via HTML. I do have a php file to handle the request and to me, it looks like it's set correctly. I've tried changing how the form is encoded and a whole bunch of other things and I just can't seem to get all information on the form to send via email.

The email's are showing up with the correct Subject and "message". But any other fields like Name/Email/Age aren't showing up in the email once it sends.

Here's my HTML

                <form action="mail.php" method="POST">
                    <p>Name</p> <input type="text" name="name">
                    <p>Email</p> <input type="text" name="email">
                    <p>Age</p> <input type="text" name="age">
                    <p>Location</p> <input type="text" name="location">
                    <p>Connection Speed</p> <input type="text" name="connection">
                    <p>Experience</p> <input type="text" name="experience">
                    <p>Why do you want to become a VAAT member?</p> <input type="text" name="why">
                    <p>Availability</p> <input type="text" name="availability">
                    <p>Preffered Position</p> <input type="text" name="position">
                    <p>Other Comments</p><textarea name="message" rows="4" cols="25"></textarea><br/>
                    <input type="submit" value="Send"><input type="reset" value="Clear">
                </form> 

...

And this is my PHP

<?php 
$name = $_POST['name'];
$email = $_POST['email'];
$age = $_POST['age'];
$location = $_POST['location'];
$connection = $_POST['connection'];
$experience = $_POST['experience'];
$why = $_POST['why'];
$availability = $_POST['availability'];
$position = $_POST['position'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$recipient = "contact@virtualaeroshell.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!" . " -" . "<a href='index.html' style='text-decoration:none;color:#C40000;'> Return Home</a>";
?>



Aucun commentaire:

Enregistrer un commentaire