I am having a hard time getting my php to work with my html. I have several sets of checkboxes and I believe that is what is not coded right. Can someone please help???
Here is the code in html and php for my checkboxes. Right now when I sumbit it sends me to a page that says “blarg!”
<form method="POST" action="mailer.php" ><p><strong>Was this contact (check all that apply)</strong></p>
<label>
<input name="contact" type="checkbox" value="In person" />
In person</label>
<br />
<label>
<input name="contact" type="checkbox" value="By phone" />
By phone</label>
<br />
<label>
<input name="contact" type="checkbox" value="By email" />
By email</label>
<br />
<label>
<input name="contact" type="checkbox" value="Fax" />
Fax</label>
<br />
<label>
<input name="contact" type="checkbox" value="No contact with the Financial Aid Office" />
No contact with the Financial Aid Office</label>
<br />
<label>
<input name="contact" type="checkbox" value="Other" />
Other</label>
<p><strong>What was the nature of your visit(s)? (check all the apply)</strong></strong><br />
<label>
<input name="nature" type="checkbox" value="Loan question/assistance" />
Loan question/assistance</label>
<br />
<label>
<input name="nature" type="checkbox" value="Scholarship question/assistance" />
Scholarship question/assistance</label>
<br />
<label>
<input name="nature" type="checkbox" value="Application/FAFSA assistance" />
Application/FAFSA assistance</label>
<br />
<label>
<input name="nature" type="checkbox" value="Debt load counseling" />
Debt load counseling</label>
<br />
<label>
<input name="nature" type="checkbox" value="HPSP question/counseling" />
HPSP question/counseling</label>
<br />
<label>
<input name="nature" type="checkbox" value="Special Circumstances Appeal" />
Special Circumstances Appeal</label>
<br />
<label>
<input name="nature" type="checkbox" value="No contact with the Financial Aid Office2" />
No contact with the Financial Aid Office</label>
</p> </form>
<?php
if(isset($_POST['submit'])) {
$to = xxx@myemail.com;
$subject = "Financial Aid Survey"; foreach($_POST['checkbox'] as $value) {
$checkbox_msg .= "Checked: $contact
";}
foreach($_POST['checkbox'] as $value) {
$checkbox_msg .= "Checked: $nature
";}
$body =Was this contact: $contact
What was the nature of your visit: $nature
;
echo "Thank you! Your information has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "blarg!";
}
?>
Thank you!