I am trying to get everything that user filled from form. After the user pressed submit button those data will send to my email account. The problem i am having now is i am not getting the data the from the checkboxes. The checkboxes can be select on or both. If the user select on it will show on my account if they selected both, both data will send to my account. currently, I have two checkboxes on the html form but when the user checked on the checkboxes, the data will not show on my email. I don't know what is wrong on my php code. Please give your precious advices. Thank you very much for your time to read my problem
Cheers,
hoachen
My html form
First Name: <input type="text"name="firstname" size="25"> <br>
LastName: <input type="text"name="lastname" size="25"> <br>
<input name="interests1" type="checkbox" value="Yes" >I'm interested on red car. <br>
<input name="interests2" type="checkbox" value=" Yes" >I'm interested on traveling. <br>
My PHP
<?php
$to="myemail@address.com";
$subject="Contact Form ";
$Message .= "First Name: " . $POST['firstname'] . "<br>";
$Message .= "Last Name: " . $POST["lastname"] . "<br>";
if(isset($POST['interests1']) && ($POST['interests1']=='Yes'))
{
$Message.=($_POST['interests1'])?"Interest: I'm interested on red car: Yes <br><br>":" \n I'm interested on red car: No <br>" ;
}
if(isset($POST['interests2']) && ($POST['interests2']=='Yes'))
{
$Message.=($_POST['interests2'])?"I'm interested on traveling: Yes <br><br>":" \nI'm interested on traveling: No <br>";
}
if (@mail($to, $subject, $message, $headers))
echo "Your information was submitted successfully...";
else
echo "Failed to send";
?>