iciman Posted October 18, 2008 Share Posted October 18, 2008 I have wrote a multi checkbox form that sends the list to me via email. I receive the email ok with the list, but the website gives an error message: Notice: Undefined variable: ch the code: <?php foreach($_POST['checkbox'] as $value) { $ch .= "Checked: $value\n"; <--------------the error refers to this line } $adi=$_POST["name"]; $name=ucwords($adi); $un=$_POST["unvan"]; $email=$_POST["email"]; $tel=$_POST["tel"]; $remarks=$_POST["remarks"]; $sebep="Maxi Pack Request"; $bana="info@xxxxxx"; ?> <? $mesaj ="Unvani: " .$un. "\n"; $mesaj .="Full Name: " .$name. "\n"; $mesaj .="Email: " .$email. "\n"; $mesaj .="Telephone Number: " .$tel. "\n"; $mesaj .="Checked: " .$ch. "\n"; $mesaj .="Remarks: " .$remarks. "\n"; $extra_baslik ="From: ".$email. "\n"; $extra_baslik .="Reply-To: ".$email. "\n"; $extra_baslik .="Cc:info@xxxxx\n"; $extra_baslik .="Bcc:xxxxxxxx\n"; $extra_baslik .= "Content-Type:text/plain; charset=\"iso-8859-9\"\n"; $extra_baslik .= "Content-Transfer-Encoding: 8bit\n"; mail($bana, $sebep, $mesaj, $extra_baslik); Can anybody see were I have gone wrong please. Link to comment https://forums.phpfreaks.com/topic/128948-solved-checkbox-and-email-form/ Share on other sites More sharing options...
beansandsausages Posted October 18, 2008 Share Posted October 18, 2008 try: $ch .= "Checked: {$value}\n"; Link to comment https://forums.phpfreaks.com/topic/128948-solved-checkbox-and-email-form/#findComment-668531 Share on other sites More sharing options...
iciman Posted October 18, 2008 Author Share Posted October 18, 2008 Thank you for your quick reply burnside but unfortunately it give the same error ??? Link to comment https://forums.phpfreaks.com/topic/128948-solved-checkbox-and-email-form/#findComment-668533 Share on other sites More sharing options...
beansandsausages Posted October 18, 2008 Share Posted October 18, 2008 $ch .= "Checked: ."$value".\n"; if not ill look at rest of code Link to comment https://forums.phpfreaks.com/topic/128948-solved-checkbox-and-email-form/#findComment-668536 Share on other sites More sharing options...
iciman Posted October 18, 2008 Author Share Posted October 18, 2008 thanks for trying but again no sorry. Link to comment https://forums.phpfreaks.com/topic/128948-solved-checkbox-and-email-form/#findComment-668539 Share on other sites More sharing options...
JasonLewis Posted October 18, 2008 Share Posted October 18, 2008 Above the foreach() place this: $ch = ""; Link to comment https://forums.phpfreaks.com/topic/128948-solved-checkbox-and-email-form/#findComment-668553 Share on other sites More sharing options...
iciman Posted October 18, 2008 Author Share Posted October 18, 2008 Thank you very much. Spot on ProjectFear Link to comment https://forums.phpfreaks.com/topic/128948-solved-checkbox-and-email-form/#findComment-668569 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.