- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hi, I am having issues capturing data from the checkboxes in my form. I can’t figure out what code needs to go into the php file for multiple selections.
The rest of the form is fine so I have left out most of the coding. Below is my html code for the checkboxes and my full php code as it stands.
Any guidance/code would be greatly aprpeciated. Thanks in advance!
**HTML Code**
Please select your preferred sessions:
**PHP Code**
$EmailTo = “[email protected]”;
$Subject = “Registration;
$Fullname = Trim(stripslashes($_POST));
$Email = Trim(stripslashes($_POST));
$Session = Trim(stripslashes($_POST));
// validation
$validationOK=true;
if (!$validationOK) {
print ““;
exit;
}
// prepare email body text
$Body = “”;
$Body .= “Fullname: “;
$Body .= $Fullname;
$Body .= “n”;
$Body .= “Email: “;
$Body .= $Email;
$Body .= “n”;
$Body .= “Session: “;
$Body .= $Session;
$Body .= “n”;
// send email
$success = mail($EmailTo, $Subject, $Body, “From: <$EmailFrom>“);
// redirect to success page
if ($success){
print ““;
}
else{
print ““;
}
?>
Try putting the code in the given “Code” tag when posting. That post is a jumbled mess and I don’t even want to attempt to decipher it! :P
Fixed some of it.
Checkbox’s return yes or no as a value. You would have to have 3 unique names for each checkbox and use PHP to see which returned YES or NO.