I’m new to PHP and am struggling on something. I have a form that has multiple arrays since users can ‘add another’ of certain fields if they have multiple entries to make. However, I cannot seem to capture the array values to send in an email. The form is working correctly in terms of inserting the data to a table and sending emails, the emails are just missing the values of the arrays. Any help would be great (i am using [] after the names of my html form fields).
[php]
<?php $con = mysql_connect("localhost","uhsaa","harkharm"); @mysql_select_db("site20_schools") ?> <?php for($i = 0; $i < 5; $i++) { $date = date("m/d/y", time()); $referee = $_POST['referee']; $email_address = $_POST['email_address']; $phone = $_POST['phone']; $gamedate = $_POST['gamedate']; $level = $_POST['level']; $home = $_POST['home']; $away = $_POST['away']; $title = $_POST['title'][$i]; $person = $_POST['person'][$i]; $first_name = $_POST['first_name'][$i]; $jersey = $_POST['jersey'][$i]; $school = $_POST['school'][$i]; $reason = $_POST['reason'][$i]; $notes = $_POST['notes'][$i]; $checkbox = $_POST['checkbox']; /* verify data, do sql escaping */ $result = mysql_query(" INSERT INTO `soccercard` (date, referee, email_address, phone, gamedate, level, home, away, title, person, first_name, jersey, school, reason, notes, checkbox) VALUES ('$date', '$referee', '$email_address', '$phone', '$gamedate', '$level', '$home', '$away', '$title', '$person', '$first_name', '$jersey', '$school', '$reason', '$notes', '$checkbox'); "); /* do result handling */ } ?> <?php $to = "$email_address"; $subject = "Soccer Card Report Form"; $message = ("Thank you $referee for submitting a Soccer Card Report Form for the $home vs. $away soccer game. $first_name from $school received a $title card."); $from = "[email protected]"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); ?>[/php]