Ok, here is the project:
The first page in this project allows a user to submit one field named 'boatcount'. Hitting the submit button on the first page takes you to a second page, which generates a form with 'boatcount' number of rows with two fields in each row. (The value of 'boatcount' is passed along in a hidden field.) The names of the fields in each row are unique for each row but have the same basic name: bfname1, blname1 - bfname2, blname2 - and loops 'boatcount' times. This data will be submitted to page three.
The following code from page three will take in the user input from page 2, loop through each row (using a simple counter), create a unique variable name for each of the two fields ($bfname1,$blname1 - $bfname2,$blname2), and assign the value of that field to the new variable. At the end of the loop, I generate a unique array ($$array) containing the two variables, $$bfname and $$blname.
$toaddress = 'someguy@yahoo.com';
$subject = 'Test Email';
$boatcount = $HTTP_POST_VARS['boatcount'];
$count = 1;
while($count <= $boatcount)
{
$bfname = 'bfname'.$count.'';
$$bfname = $HTTP_POST_VARS['bfname'.$count.''];
$blname = 'blname'.$count.'';
$$blname = $HTTP_POST_VARS['blname'.$count.''];
$array = 'array'.$count.'';
$$array = ( $$bfname, $$blname );
$count = ($count + 1);
}
At the end of this script, I want to email the contents of each of these 'boatcount' number of arrays to a user with a space between each element, and a new line between each array:
$mailcontent = "$array1[0] $array1[1]\n"
."$array2[0] $array2[1]\n"
."$array3[0] $array3[1]\n";
and so on..
I need the to somehow add each array generated by my loop to be placed into $mailcontent, so I can send all of the results at once. How can I do this??? Thanks for taking the time to read this, let alone offer your assistance!
Devin