I have a from which fetched basic fields but I would like to put in some values which are arrays. Here is an example of the post data when the form is submitted.
successArray (
[rsvpname] => wewqewqe
[rsvpemail] => ewwqe@ffdfs.com
[rsvpphone] => 23232
[rsvpcomments] => 21321
[guests] => 1
[mainmeal] => Array (
[0] => Chicken
[1] => Fish
)
[secondmeal] => Array (
[0] => Chicken
[1] => Fish
)
[desert] => Array (
[0] => Chocolate Cake
[1] => Pumpkin Cheesecake
)
[menunotes] => Array (
[0] => 231312321
[1] => 231312321
)
[to] => myemail@gmail.com
[subject] => RSVP form message
[submit] => SEND RSVP
)
To add an array I have appended [] to the names of said fields. Here is my
processing.php.
$mainmeal = stripslashes($_POST['mainmeal[]']);
$secondmeal = stripslashes($_POST['secondmeal[]']);
$desert = stripslashes($_POST['desert[]']);
$menunotes = stripslashes($_POST['menunotes[]']);
Then it puts into an email but I don't know how to echo out the array.
// Let's send the email.
if(!$error) {
$messages="From: $email <br>";
$messages.="Name: $name <br>";
$messages.="Email: $email <br>";
$messages.="Phone: $phone <br>";
$messages.="Message: $message <br><br>";
$messages.="No. of guests: $guests <br>";
$messages.="Meal selection: $mainmeal <br>";
$messages.="Second Meal selection: $secondmeal <br>";
$messages.="Desert selection: $desert <br>";
$messages.="Menu notes: $menunotes <br>";
$emailto=$to;
$mail = mail($emailto,$subject,$messages,"from: $from <$Reply>
Reply-To: $Reply
Content-type: text/html");
if($mail) {
echo 'success';
print_r($_POST);
}
} else {
echo '<div class="error">'.$error.'</div>';
}
All the fields name, email phone etc get sent but not the arrays. How do I make it so it will send the arrays also?