This question already has an answer here:
- Radio button checked property 4 answers
I have a simple contact form that works great. I'm trying to add two radio buttons for a user to select. The choice they select will show up in the email I receive. How do I go about obtaining the value they select from the radio buttons?
html:
<div class="form-row">
<div class="form-group col-md-">
<label class="radio-inline "><input type="radio" name="current" checked>I'm an existing client</label>
</div>
<div class="form-group col-md-6 pb-2">
<label class="radio-inline "><input type="radio" name="not-current">I'm not a client yet</label>
</div>
</div>
PHP:
<?php
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$organization = $_POST['organization'];
$phone = $_POST['phone'];
$zip = $_POST['zip'];
$message = $_POST['message'];
$email_from = 'Contact Us';
$email_subject = 'New Message';
$email_body = "First Name: $firstname.
".
"Last Name: $lastname.
".
"Email: $email.
".
"Company: $organization.
".
"Phone: $phone.
".
"Zip Code: $zip.
".
"Message: $message.
";
$to ="email@email.com";
$headers = "From: $email_from
";
$headers .= "Reply-To: $email
";
mail($to,$email_subject,$email_body,$headers);
header("location: thankyou.html");
?>
</div>