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. Quote Link to comment Share on other sites More sharing options...
beansandsausages Posted October 18, 2008 Share Posted October 18, 2008 try: $ch .= "Checked: {$value}\n"; Quote Link to comment 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 ??? Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted October 18, 2008 Share Posted October 18, 2008 Above the foreach() place this: $ch = ""; Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.