Jump to content

How to send data to 1 email?


redskin

Recommended Posts


<?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,


Hereby the corfirmation of your request.

We have inserted your data in our database (please check it up):



No : $row[0]
Name : $name
Address : $address
Zip : $zip
City : $city
Phone : $phone
E-Mail : $email
Kind data : $kinddata

";

$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);

}
?>

 Thank's, we wil answer your request soon. You have sent:



Request
No : <?php
$ord = mysql_query("SELECT aanmldid FROM aanmelding ORDER BY aanmldid DESC LIMIT 1");
$row = mysql_fetch_row($ord);
echo $row[0];
?>
Name : <?php echo $name;?>
Address : <?php echo $address;?>
Zip : <?php echo $zip;?>
City : <?php echo $city;?>
Phone : <?php echo $phone;?>
E-Mail : <?php echo $email;?>




Kidname

Age

Lesson

<?php
$kidname = isset($_POST["kidname"]) ? $_POST["kidname"] : array();
foreach($kidname as $value1) echo $value1.'
';
?>

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

<?php
$lesson = isset($_POST["lesson"]) ? $_POST["lesson"] : array();
foreach($lesson as $value3) echo $value3.'
';
?>





D A T A B A S E


<?php
//select tabel
$sql = "SELECT * FROM aanmelding ORDER BY aanmldid DESC";
$res = mysql_query($sql);
?>
ID Name Address Zip City Phone E-mail Kid data
$row[0] $row[1] $row[2] $row[3] $row[4] $row[5] $row[6] $row[7]


Link to comment
Share on other sites


T e s t





Kid informations

Kidname Age Lesson
selectChines
GermanFranceEnglishItalian
NederlandsSpain

[+]   [-]




Parent informations

Name :
Address :
Zip :
City :
Phone :
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]);
}
$kdata = $kidname."".$$age."".$lesson;
?>






Edited by redskin
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...