I just learnt php yesterday. I have a problem whenever I submit the form on my webpage.It gives me Warning: Variable passed to each() is not an array or object. The array part in my form would be the group of checkbox. I set the name of the checkboxes to be "name=Contact_m e[]" ,which should make it an array(or is it not?) I've searched for similar topics, trying to figure out what's wrong,but I just can't figure it out. Can somebody please help me?
Code:
<?php $recipient = "me@hotmail.com"; $subject = "Business Enquiry"; //------------------------------------------------ $q1_requirment = $_POST['requirment']; $q2_quantity = $_POST['quantity']; $q3_purchaseTime = $_POST['purchaseTime']; $q4_companyName = $_POST['companyName']; $q5_contactPerson = $_POST['contactPerson']; $q6_email = $_POST['email']; $q7_phoneNumber = $_POST['phoneNumber']; $q8_fax = $_POST['fax']; $q9_streetAddress = $_POST['streetAddress']; $q10_city = $_POST['city']; $q11_postalCode = $_POST['postalCode']; $q12_country = $_POST['country']; $q13_contactMe = $_POST['Contact_me']; //-------------------------------------------------- while ((list($key,$val) = each($q13_contactMe))) { $q13_contactMe .= "[" . $val . "]"; } $content = "Business Enquiry:\n ===========================================================\n Requirments:\n $q1_requirment\n ===========================================================\n Estimated quantity: $q2_quantity\n ===========================================================\n Purchase Time: $q3_purchaseTime\n ===========================================================\n Contact person: $q5_contactPerson\n ===========================================================\n Company name: $q4_companyName\n ===========================================================\n Email: $q6_email\n ===========================================================\n Phone Number: $q7_phoneNumber\n ===========================================================\n Fax number: $q8_fax\n ===========================================================\n Address: $q10_streetAddress.".".$q10_city.".".$q11_postalCode.".".$q12_country\n ===========================================================\n Contact(prefered): $q13_contactMe\n"; $header = "From:$q4_companyName\n"."Reply-To:$q5_contactPerson"; mail($recipient, $subject, $content, $header); exit; ?> <p align="center">Your enquiry has been sent.</p> <p align="center">Thank you for choosing FirstChoice Canada! </p>
Comment