I'm having difficulty getting my PHP code to read my HTML check-box code.

Basically, when I submit my test form I get the following error message,

Warning: Cannot modify header information - headers already sent by (output started at /home3/seguemin/public_html/feedback.php:83) in /home3/seguemin/public_html/feedback.php on line 110.

I am very new to PHP, so I'm not sure what this means or what to do to fix it. Any help would be appreciated, my code snippets are below and this is the link for my site, www.segueministries.org Thanks!

foreach ($area as $areaofinterest) {
    echo "$areaofinterest";

$messageproper =
    "The following information has been submitted through the 'Friends of Segue' online form." . $content_nl . $content_nl .
    "Name: $fullname" . $content_nl .
    "Occupation: $occupation" . $content_n1 . $content_nl .
    "Email: $email" . $content_nl .
    "Address: $address" . $content_n1 . $content_nl .
    "Phone: $phone" . $content_n1 . $content_nl .
    "Community: $community" . $content_n1 . $content_nl .
    "Child(s) Name: $childsName" . $content_n1 . $content_nl .
    "Childs(s) School: $childsSchool" . $content_n1 . $content_nl .
    "Child(s) Grade: $childsGrade" . $content_n1 . $content_nl .
    "Segue area of interest: $area" . $content_n1 . $content_nl ;

$headers =
    "From: \"$fullname\" <$fromemail>" . $headersep . "Reply-To: \"$fullname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.16.2" .
    $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ;

if ($use_envsender) {
    mail($mailto, $subject, $messageproper, $headers, $envsender );
else {
    mail($mailto, $subject, $messageproper, $headers );

header ( "Location: $thankyouurl" );
exit ;


<input type="checkbox" value="Campus Outreach" name="area[]"> Campus Outreach<br />
<input type="checkbox" value="Leadership (Spectrum)" name="area[]"> Leadership (Spectrum)<br />
<input type="checkbox" value="Abstinence Classes (Flipside)" name="area[]"> Abstinence Classes (Flipside)<br />
<input type="checkbox" value="Mentorship (15)" name="area[]"> Mentorship (15)<br />
<input type="checkbox" value="Prevention & Recovery-Drugs/Alcohol (Pathways)" name="area[]"> Prevention & Recovery-Drugs/Alcohol (Pathways)

Recommended Answers

All 6 Replies

Remove this from your code echo "$areaofinterest";

Remove the white space and empty line before and after the PHP enclose tags.

//Start your PHP code here. Do not left a space or empty line

//End your PHP code here. Do not left a space or empty line

header must be top of the codes. Don't use headers bottom of html codes.
The "headers already sent" error is usually caused by having white space before or after the opening and closing PHP tags (<?php . . . ?>).

Remove this from your code echo "$areaofinterest";


Thanks for your response, it worked! However, in the email it sends, if I check more than one checkbox, it only shows the last one, any ideas?

Thanks so much!


Where to show ?

foreach ($area as $areaofinterest) {
echo "$areaofinterest";

Your codes are ok. It might be work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.