eccoti il codice:
<?php
// Get data from form
if($formMethod == "post") {
$name = $_POST['name'];
$surname = $_POST['surname'];
$birthday = $_POST['birthday'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$abbonamento = $_POST['abbonamento'];
$catprof = $_POST['catprof'];
$fasceora = $_POST['fasceora'];
$attivita = $_POST['attivita'];
$zonaresi = $_POST['zonaresi'];
$sesso = $_POST['sesso'];
$agree = $_POST['agree'];}
else {
$name = $_GET['name'];
$surname = $_GET['surname'];
$birthday = $_GET['birthday'];
$email = $_GET['email'];
$telephone = $_GET['telephone'];
$abbonamento = $_GET['abbonamento'];
$catprof = $_GET['catprof'];
$fasceora = $_GET['fasceora'];
$attivita = $_GET['attivita'];
$zonaresi = $_GET['zonaresi'];
$sesso = $_GET['sesso'];
$agree = $_POST['agree'];}
// controllo campi vuoti
if (empty($name) || empty($surname) || empty($birthday) || empty($email) || empty($telephone) || empty($abbonamento) || empty($catprof) || empty($fasceora) || empty($attivita) || empty($zonaresi) || empty($sesso)) {
echo "One or more fields are missing information.\r\n"; }
else {
// Connect to MySQL
mysql_connect($mySQLhost, $mySQLuser, $mySQLpass)
or die("Could not connect: " . mysql_error());
mysql_select_db($mySQLdb);
// Insert the data into the database
if (mysql_query("INSERT INTO $mySQLtable (name,surname,birthday,email,telephone,abbonamento ,catprof,fasceora,attivita,zonaresi,sesso,privacy, code) VALUES ('$name','$surname','$birthday','$email','$telepho ne','$abbonamento','$catprof','$fasceora','$attivi ta','$zonaresi','$sesso','$agree','$code')")) {
echo "<table width=\"400px\" border=\"\0\" style=\"text-align:center;margin-right:auto;margin-left:auto;\">
<tr>
<th style=\"color:#ff0000;\">Registrazione avvenuta con Successo!</th>
<th></th>
</tr>
<tr>
<td>fissa un appuntamento </td>
<td></td>
</tr>
</table>"; }
else { echo $regFailed ;}
mysql_close(); }
?>
<?php
$to = $_POST["email"];
$from = "registrazione@mail.org";
$subject = "Dati registrazione";
// message
$message = '
<title style="text-align:center;color:#cc0000;">MODULO REGISTRAZIONE </title>
<tr>Stampa questa mail e presentalo alla reception</tr>
<table>
<tr>
<th>a</th>
<th>v</th>
</tr>
<tr>
<td>ID REGISTRAZIONE</td>
<td>$code</td>
</tr>
<tr><hr></tr>
<tr>
<td>NOME</td>
<td>$name</td>
</tr>
<tr>
<td>COGNOME</td>
<td>$surname</td>
</tr>
<tr>
<td>ABBONAMENTO SCELTO</td>
<td>$abbonamento</td>
</tr>
<tr>
<td>CATEGORIA PROFESSIONALE</td>
<td>$catprof</td>
</tr>
<tr>
<td>FASCIA ORARIA</td>
<td>$fasceora</td>
</tr>
<tr>
<td>ZONA di RESIDENZA</td>
<td>$zonaresi</td>
</tr>
<tr>
<th>Tutela della Privacy</th>
<th></th>
</tr>
</table>';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Mail it
$headers = "From: " . $from . "\r\n";
$mailsent = mail ($to, $subject, $message, $headers);
if ($mailsent) {
echo "Abbiamo spedito all'indirizzo indicato un Promemoria." . "\r\n" . "Stampalo e presentalo al momento dell'iscrizione." . "\r\n" . "Grazie";
} else {
echo "Ci sono stati errori";
}
?>

Rispondi quotando