Hi,
I have a form with an array. kidname, age and lesson.
http://jawaweb.com/e1.jpg
I fill up with 2 kids to join, when i click on send, there are 2 email sent to same addresses and all the informations going to mysql database. confirmation pagina shows.
http://jawaweb.com/e2.jpg
When i view a joinform, data comes from mysql using 2 colomn
http://jawaweb.com/e3.jpg
if i fill up with 3 kids, it will send 3 email ect.
how to send all kiddata to 1 email?
perhaps someone can help me?
thanks in advance.

<body>
<?php
//Database connection
require "db.php";

// Data Form
if (isset($_POST["naam"])) $name = $_POST["name"];
if (isset($_POST["address"])) $address = $_POST["address"];
if (isset($_POST["zip"])) $zip = $_POST["zip"];
if (isset($_POST["city"])) $city = $_POST["city"];
if (isset($_POST["phone"])) $phone = $_POST["phone"];
if (isset($_POST["email"])) $email = $_POST["email"];

foreach($_POST['kidname'] as $row => $value1)
{
$kidname = mysql_real_escape_string($value1);
$age = mysql_real_escape_string($_POST['age'][$row]);
$lesson = mysql_real_escape_string($_POST['lesson'][$row]);
$kiddata = $kidname . " - " . $age . " - " . $lesson;

//echo $name.$address.$zip.$city.$phone.$email.$kiddata.
$sql = "INSERT INTO aanmelding VALUES (NULL, '$name', '$address', '$zip', '$city', '$phone', '$email', '$kiddata')";
$res = mysql_query($sql);

if ($res){
}

$ord = mysql_query("SELECT aanmldid FROM aanmelding ORDER BY aanmldid DESC LIMIT 1");
$row = mysql_fetch_row($ord);
        
if (!empty($email)){
$ontvanger = $email;
}

        
        
$to = EMAIL;
$subject = "Request";
$datas = "Dear Sir/Madam $name, <br><br>
Hereby the corfirmation of your request.<br>
We have inserted your data in our database (please check it up): <br>
<br>
<table>
    <tr><td width=190>No</td><td>:</td><td>$row[0]</td></tr>
    <tr><td>Name</td><td>:</td><td>$name</td></tr>
    <tr><td>Address</td><td>:</td><td>$address</td></tr>
    <tr><td>Zip</td><td>:</td><td>$zip</td></tr>
    <tr><td>City</td><td>:</td><td>$city</td></tr>
    <tr><td>Phone</td><td>:</td><td>$phone</td></tr>
    <tr><td>E-Mail</td><td>:</td><td>$email</td></tr>
    <tr><td>Kind data</td><td>:</td><td>$kinddata</td></tr>
</table>
";

$header = "From: ".$name." <".$email.">\r\n";    
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html; charset=iso-8859-1\r\n";
$header .= "Reply-To: ".$name." <".$email.">\r\n"; 
@mail($to, $subject, $datas, $header);
        
}
?>

<h2>&nbsp;Thank's, we wil answer your request soon. You have sent:</h2><br>
<fieldset><legend><font color="#FE9A2E"><b>Request</b></font></legend>
<table>
    <tr>
        <td width="190">No</td><td>:</td>
        <td><?php            
            $ord = mysql_query("SELECT aanmldid FROM aanmelding ORDER BY aanmldid DESC LIMIT 1");
            $row = mysql_fetch_row($ord);
            echo $row[0];
            ?></td></tr>
    <tr><td>Name</td><td>:</td><td><?php echo $name;?></td></tr>
    <tr><td>Address</td><td>:</td><td><?php echo $address;?></td></tr>
    <tr><td>Zip</td><td>:</td><td><?php echo $zip;?></td></tr>
    <tr><td>City</td><td>:</td><td><?php echo $city;?></td></tr>
    <tr><td>Phone</td><td>:</td><td><?php echo $phone;?></td></tr>
    <tr><td>E-Mail</td><td>:</td><td><?php echo $email;?></td></tr>        
</table>
<br>
<table class="tabel" cellpadding="4" cellspacing="0">
    <tr bgcolor="#e5e5e5">
        <td width="100">
        Kidname</td>
    
        <td width="100">
        Age</td>
    
        <td width="150">
        Lesson</td>
    </tr>
    <tr>
        <td width="100">
        <?php 
        $kidname = isset($_POST["kidname"]) ? $_POST["kidname"] : array();
        foreach($kidname as $value1) echo $value1.'<br />';
        ?> 
        </td>
    
        <td width="100">
        <?php
        $age = isset($_POST["age"]) ? $_POST["age"] : array();        
        foreach($age as $value2) echo $value2.'<br />'; 
        ?> 
        </td>
    
        <td width="150">
        <?php
        $lesson = isset($_POST["lesson"]) ? $_POST["lesson"] : array();
        foreach($lesson as $value3) echo $value3.'<br />';    
        ?>
        </td>
    </tr>
</table>
</fieldset><br><br><br>
<fieldset><legend><font color="blue"><b>D A T A B A S E</b></font></legend>
<br>
<?php
//select tabel 
$sql = "SELECT * FROM aanmelding ORDER BY aanmldid DESC";
$res = mysql_query($sql);
?>
<table class="tabel" cellpadding="4" cellspacing="0">
    <tr bgcolor="#e5e5e5">
          <td><span>ID</span></td>
          <td><span>Name</span></td>
          <td><span>Address</span></td>
          <td><span>Zip</span></td>
          <td><span>City</span></td>
          <td><span>Phone</span></td>
          <td><span>E-mail</span></td>
          <td><span>Kid data</span></td>
    </tr>
<?php
//display data from selected tabel
    while ($row = mysql_fetch_row($res)){
        echo "<tr>
<td valign=top><span>$row[0]</span></td> 
<td valign=top><span>$row[1]</span></td> 
<td valign=top><span>$row[2]</span></td> 
<td valign=top><span>$row[3]</span></td> 
<td valign=top><span>$row[4]</span></td> 
<td valign=top><span>$row[5]</span></td> 
<td valign=top><span>$row[6]</span></td>
<td valign=top><span>$row[7]</span></td>
</tr>";
}
?> 
</table></fieldset>

</body>
</html>

Separate the email and database processing
at the moment the email is inside the 'for each' loop so a mail is generated for each table entry

generate email header
'for each' processing to update database and generate each new kidname data
generate email footer and send email

1 kid 1 email
2 kids 1 email
3 kids 1 email
99999 kids 1 email

$to = EMAIL;
$subject = "Request";
$datas = "Dear Sir/Madam $name, <br><br>
Hereby the corfirmation of your request.<br>
We have inserted your data in our database (please check it up): <br>
<br>";

foreach($_POST['kidname'] as $row => $value1)
{
$kidname = mysql_real_escape_string($value1);
$age = mysql_real_escape_string($_POST['age'][$row]);
$lesson = mysql_real_escape_string($_POST['lesson'][$row]);
$kiddata = $kidname . " - " . $age . " - " . $lesson;

//echo $name.$address.$zip.$city.$phone.$email.$kiddata.
$sql = "INSERT INTO aanmelding VALUES (NULL, '$name', '$address', '$zip', '$city', '$phone', '$email', '$kiddata')";
$res = mysql_query($sql);

if ($res){
}

$ord = mysql_query("SELECT aanmldid FROM aanmelding ORDER BY aanmldid DESC LIMIT 1");
$row = mysql_fetch_row($ord);
        
if (!empty($email)){
$ontvanger = $email;
}

data .="<table>
    <tr><td width=190>No</td><td>:</td><td>$row[0]</td></tr>
    <tr><td>Name</td><td>:</td><td>$name</td></tr>
    <tr><td>Address</td><td>:</td><td>$address</td></tr>
    <tr><td>Zip</td><td>:</td><td>$zip</td></tr>
    <tr><td>City</td><td>:</td><td>$city</td></tr>
    <tr><td>Phone</td><td>:</td><td>$phone</td></tr>
    <tr><td>E-Mail</td><td>:</td><td>$email</td></tr>
    <tr><td>Kind data</td><td>:</td><td>$kinddata</td></tr>
</table>
";

you can copy paste the rest

Thanks for reply,

it just create an erroy.

Parse error: parse error, unexpected T_CONCAT_EQUAL in C:\EasyWAMP\www\form\confirm.php on line 79

datas .="<table>
    <tr><td width=190>No</td><td>:</td><td>$row[0]</td></tr>
    <tr><td>Name</td><td>:</td><td>$name</td></tr>
    <tr><td>Address</td><td>:</td><td>$address</td></tr>
    <tr><td>Zip</td><td>:</td><td>$zip</td></tr>
    <tr><td>City</td><td>:</td><td>$city</td></tr>
    <tr><td>Phone</td><td>:</td><td>$phone</td></tr>
    <tr><td>E-Mail</td><td>:</td><td>$email</td></tr>
    <tr><td>Kind data</td><td>:</td><td>$kinddata</td></tr>
</table>
";
<body>
<?php
//Database connection
require "db.php";

// Data Form
if (isset($_POST["naam"])) $name = $_POST["name"];
if (isset($_POST["address"])) $address = $_POST["address"];
if (isset($_POST["zip"])) $zip = $_POST["zip"];
if (isset($_POST["city"])) $city = $_POST["city"];
if (isset($_POST["phone"])) $phone = $_POST["phone"];
if (isset($_POST["email"])) $email = $_POST["email"];

foreach($_POST['kidname'] as $row => $value1)
{
$kidname = mysql_real_escape_string($value1);
$age = mysql_real_escape_string($_POST['age'][$row]);
$lesson = mysql_real_escape_string($_POST['lesson'][$row]);
$kiddata = $kidname . " - " . $age . " - " . $lesson;

//echo $name.$address.$zip.$city.$phone.$email.$kiddata.
$sql = "INSERT INTO aanmelding VALUES (NULL, '$name', '$address', '$zip', '$city', '$phone', '$email', '$kiddata')";
$res = mysql_query($sql);

if ($res){
}

$ord = mysql_query("SELECT aanmldid FROM aanmelding ORDER BY aanmldid DESC LIMIT 1");
$row = mysql_fetch_row($ord);

/* this goes outside the for loop
if (!empty($email)){
$ontvanger = $email;
}



$to = EMAIL;
$subject = "Request";
$datas = "Dear Sir/Madam $name, <br><br>
Hereby the corfirmation of your request.<br>
We have inserted your data in our database (please check it up): <br>
<br>";
*/
/* this goes inside the for loop
datas .= "<table>
    <tr><td width=190>No</td><td>:</td><td>$row[0]</td></tr>
    <tr><td>Name</td><td>:</td><td>$name</td></tr>
    <tr><td>Address</td><td>:</td><td>$address</td></tr>
    <tr><td>Zip</td><td>:</td><td>$zip</td></tr>
    <tr><td>City</td><td>:</td><td>$city</td></tr>
    <tr><td>Phone</td><td>:</td><td>$phone</td></tr>
    <tr><td>E-Mail</td><td>:</td><td>$email</td></tr>
    <tr><td>Kind data</td><td>:</td><td>$kinddata</td></tr>
</table>
";
*/
/* this goes outside the for loop
$header = "From: ".$name." <".$email.">\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html; charset=iso-8859-1\r\n";
$header .= "Reply-To: ".$name." <".$email.">\r\n";
@mail($to, $subject, $datas, $header);
*/
}
?>

<h2>&nbsp;Thank's, we wil answer your request soon. You have sent:</h2><br>
<fieldset><legend><font color="#FE9A2E"><b>Request</b></font></legend>
<table>
    <tr>
        <td width="190">No</td><td>:</td>
        <td><?php
            $ord = mysql_query("SELECT aanmldid FROM aanmelding ORDER BY aanmldid DESC LIMIT 1");
            $row = mysql_fetch_row($ord);
            echo $row[0];
            ?></td></tr>
    <tr><td>Name</td><td>:</td><td><?php echo $name;?></td></tr>
    <tr><td>Address</td><td>:</td><td><?php echo $address;?></td></tr>
    <tr><td>Zip</td><td>:</td><td><?php echo $zip;?></td></tr>
    <tr><td>City</td><td>:</td><td><?php echo $city;?></td></tr>
    <tr><td>Phone</td><td>:</td><td><?php echo $phone;?></td></tr>
    <tr><td>E-Mail</td><td>:</td><td><?php echo $email;?></td></tr>
</table>
<br>
<table class="tabel" cellpadding="4" cellspacing="0">
    <tr bgcolor="#e5e5e5">
        <td width="100">
        Kidname</td>

        <td width="100">
        Age</td>

        <td width="150">
        Lesson</td>
    </tr>
    <tr>
        <td width="100">
        <?php
        $kidname = isset($_POST["kidname"]) ? $_POST["kidname"] : array();
        foreach($kidname as $value1) echo $value1.'<br />';
        ?>
        </td>

        <td width="100">
        <?php
        $age = isset($_POST["age"]) ? $_POST["age"] : array();
        foreach($age as $value2) echo $value2.'<br />';
        ?>
        </td>

        <td width="150">
        <?php
        $lesson = isset($_POST["lesson"]) ? $_POST["lesson"] : array();
        foreach($lesson as $value3) echo $value3.'<br />';
        ?>
        </td>
    </tr>
</table>
</fieldset><br><br><br>
<fieldset><legend><font color="blue"><b>D A T A B A S E</b></font></legend>
<br>
<?php
//select tabel
$sql = "SELECT * FROM aanmelding ORDER BY aanmldid DESC";
$res = mysql_query($sql);
?>
<table class="tabel" cellpadding="4" cellspacing="0">
    <tr bgcolor="#e5e5e5">
          <td><span>ID</span></td>
          <td><span>Name</span></td>
          <td><span>Address</span></td>
          <td><span>Zip</span></td>
          <td><span>City</span></td>
          <td><span>Phone</span></td>
          <td><span>E-mail</span></td>
          <td><span>Kid data</span></td>
    </tr>
<?php
//display data from selected tabel
    while ($row = mysql_fetch_row($res)){
        echo "<tr>
<td valign=top><span>$row[0]</span></td>
<td valign=top><span>$row[1]</span></td>
<td valign=top><span>$row[2]</span></td>
<td valign=top><span>$row[3]</span></td>
<td valign=top><span>$row[4]</span></td>
<td valign=top><span>$row[5]</span></td>
<td valign=top><span>$row[6]</span></td>
<td valign=top><span>$row[7]</span></td>
</tr>";
}
?>
</table></fieldset>

</body>
</html>

I have copied and pasted your code and got the same result as before.
maybe i have to start it from the first page

<body>
<div id="credit"><b>T e s t</b></div>
<br>
<form name="data" method="post" action="confirmation.php" onSubmit="return validate(this);">
<fieldset> <legend>
<font color="blue"><b>Kid informations</b></font></legend><br>
<table id="table_formcontainer">
    <tr bgcolor="#e5e5e5">
          <td width="200"> Kidname </td> <td width="20"> Age </td> <td width="80"> Lesson </td>            
     </tr>
     <tr>
          <td><input name="kidname[]" size="40"></td> <td><input name="age[]" size="5"></td> 
          <td><select name="lesson[]"><option value="select">select</option><option>Chines</option>
          <option>German</option><option>France</option><option>English</option><option>Italian</option>
          <option>Nederlands</option><option>Spain</option></select></td>            
     </tr>     
</table>
<table>     
     <tr>
              <td width="500" align="right">[<b><a href="#" onclick='add_formrow();'>+</a></b>]</td>
            <td>&nbsp;</td><td>[<b><a href="#" onclick='del_formrow();'>-</a></b>]</td>      
     </tr>
</table>
<br>
<fieldset> <legend>
<font color="blue"><b>Parent informations</b></font></legend><br>
<table>
    <tr>
            <td width="100">Name</td> <td>:</td> <td><input name="naam" size="50"></td>            
    </tr>
    <tr>
            <td width="100">Address</td> <td>:</td> <td><input name="adres" size="50"></td>            
    </tr>
    <tr>
            <td width="100">Zip</td> <td>:</td> <td><input name="postcode" size="50"></td>            
    </tr>
    <tr>
            <td width="100">City</td> <td>:</td> <td><input name="woonplaats" size="50"></td>            
    </tr>
    <tr>
            <td width="100">Phone</td> <td>:</td> <td><input name="telefoon" size="50"></td>            
    </tr>
    <tr>
            <td width="100">Email</td> <td>:</td> <td><input name="email" size="50"></td>            
    </tr>
</table>
<table>    
    <tr>
            <td width="100">&nbsp;</td> <td>&nbsp;</td>
            <td><br><input type="submit" name="submit" value=" C o n f i r m ">&nbsp;&nbsp;
            <input type="button" value=" R e s e t " onclick="reset()"></td>
    </tr>
</table>
<?
foreach($_POST['kidname'] as $row => $value1)
{
$kidname = mysql_real_escape_string($value1);
$age = mysql_real_escape_string($_POST['age'][$row]);
$lesson = mysql_real_escape_string($_POST['lesson'][$row]);
}
$kdata = $kidname."".$$age."".$lesson;
?>
<input type="hidden" name="kiddata" value="<?php echo $kdata?>">

</form></fieldset>        

<br>
</body>
</html>

then i need to make some change on te next page.

// Data Form

if (isset($_POST["kiddata"])) $kiddata = $_POST["kiddata"];

but then nothing shows on the kiddata colomn.
any idea perhaps

I did not rewrite your code
I wrote
this should be outside the for each loop

generation of the header for the email
send email
should be outside the for each loop
it is processed only once,
generate one email with a mail body comprised of the tables containing kiddata
writing your code is your problem,
validating your code is your problem

Yeah, please separate the MySQL data from the email script.

My sql data

-- 
-- Table structure for table `aanmelding`
-- 

CREATE TABLE `aanmelding` (
  `aanmldid` int(10) NOT NULL auto_increment,
  `name` varchar(50) NOT NULL default '',
  `addreas` varchar(50) NOT NULL default '',
  `zip` varchar(10) NOT NULL default '',
  `city` varchar(50) NOT NULL default '',
  `phone` varchar(20) NOT NULL default '',
  `email` varchar(50) NOT NULL default '',
  `kiddata` varchar(100) NOT NULL default '',
  PRIMARY KEY  (`aanmldid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 
;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.