I've followed a PHP contact form tutorial from https://1stwebdesigner.com/php-contact-form-html/, everything prints out fine in the email that's sent to the recipient, except the selected value in the dropdown box.
So how exactly could I get one of the 4 values to be printed in the email?
Here is a snippet from the HTML file:
<form action="emailform.php" method="POST">
<p>Full Name</p> <input type="text" name="name">
<p>Email</p> <input type="text" name="email">
<p>Subject</p>
<select name="list">
<option value="booking">Booking Query</option>
<option value="payment">Request Payment Details</option>
<option value="error">Report Website Error</option>
<option value="other">Other</option>
</select>
<br />
<p>Message</p><textarea name="message" rows="6" cols="25"></textarea><br />
<input type="submit" value="Send">
</form>
And the PHP file:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$list = $POST['list'];
$message = $_POST['message'];
$formcontent="From: $name \n Subject: $list \n Message: $message";
$recipient = "email@example.com";
$subject = "Aeron Valley Classic Hire";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!" . " -" . "<a href='contact.html' style='text-decoration:none;color:#B22222;'> Return Home</a>";
?>
I'm not very good at this, but although I've followed every step of the tutorial I do wonder how the PHP code actually knows what the values are and how to display them?
Any help would be appreciated.