When I hit the Submit button on my registration form, I get this:
Warning: Invalid argument supplied for foreach() in /Volumes/Data/www/Intrepid/TonySweet/website/mailer2.php on line 30
The information comes through in the email just fine, but I don't want this to show up to clients when they submit.
I have no background in this, and I'm just trying to figure it out as I go along. Here's mailer2.php:
<?php
if(isset($_POST['submit'])) {
$to = "kelly@tonysweet.com";
$subject = "Registration Form";
$name_field = $_POST['name'];
$phone_field = $_POST['phone'];
$cell_field = $_POST['cell'];
$email_field = $_POST['email'];
$website_field= $_POST['website'];
$address_field = $_POST['address'];
$city_state_zip_field = $_POST['city_state_zip'];
$multiple = $_POST['multiple[]'];
$dropdown = $_POST['drop_down'];
$dropdown2 = $_POST['drop_down2'];
$referred_field = $_POST['referred'];
$emer_contact_field = $_POST['emer_contact'];
$relation_field = $_POST['relation'];
$emer_home_field = $_POST['emer_home'];
$emer_cell_field = $_POST['emer_cell'];
$equipment_field = $_POST['equipment'];
$cc_name_field = $_POST['ccname'];
$date_field = $_POST['date'];
$option = $_POST['radio'];
$option2 = $_POST['radio2'];
$message_field = $_POST['message'];
}
foreach($_POST['multiple'] as $key) {
$key .= "$value\n";
}
$body = "Name: $name_field\n Home Phone: $phone_field\n Cell Phone: $cell_field\n E-Mail: $email_field\n Website: $website_field\n Address: $address_field\n City,State,Zip: $city_state_zip_field\n Workshop: $key Photography Level: $dropdown\n Photography Interest: $dropdown2\n Referral: $referred_field\n Emergency Contact: $emer_contact_field\n Relation: $relation_field\n Home: $emer_home_field\n Cell: $emer_cell_field\n Equipment: $equipment_field\n Agreed: $cc_name_field\n Date: $date_field\n Option: $option\n Method: $option2\n Message:\n $message_field\n";
if (mail($to, $subject, $body)) {
echo "Your registration has been submitted to $to! You will receive an email confirmation shortly.";
} else {
echo "Data was not sent!";
}
?>
Thanks for your help!