Ragazzi scusate, ho provato ad aggiungere questo script al mio e mi invia i dati alle due tabelle e arriva anche l'email , come posso fargli visualizzare i dati all utente cioe' nome, cognome email, ecc ecc
ecco il codice:
Codice PHP:
$db = mysql_connect ($db_host, $db_user, $db_password);
$db_forum = mysql_select_db ($db_name, $db);
// query di inserimento
$query = "INSERT INTO `registrati` (nome, cognome, email, indirizzo, citta, provincia, cap, nazione, telefono, fax, reg, piva, data)
VALUES ('".$_POST['nome']."', '".$_POST['cognome']."', '".$_POST['email']."', '".$_POST['indirizzo']."', '".$_POST['citta']."', '".$_POST['provincia']."', '".$_POST['cap']."', '".$_POST['nazione']."', '".$_POST['telefono']."', '".$_POST['fax']."', '".$_POST['reg']."', '".$_POST['piva']."', '".date('Y-m-d H:i:s')."')";
$query2 = "INSERT INTO `news` (nome, cognome, email, data)
VALUES ('".$_POST['nome']."', '".$_POST['cognome']."', '".$_POST['email']."', '".date('Y-m-d H:i:s')."')";
// esecuzione della query
$query_results = mysql_query($query) or die("error=1");
$query_results2 = mysql_query($query2) or die("error=1");
//------------------------------------------------------------------------------------------------------
$email = "".$row["email"]."";
$nome = "".$row["nome"]."";
$testo = "".$row["testo"]."";
$to = $email; // e-mail destinatario che ricavi dalla tua query
$cc = "info@xxxxxxx.com"; // tuo indirizzo e-mail non necessario se vuoi per ora
$subject = "Ciao: $nome"; // scrivi quello che vuoi qui, ti ho lasciato la variabile "NOME"
$message = "Ciao\n\r";
$message .= "[b]$nome[/b]
\r\n";
$message .= "ecco quello che hai nel tuo form:
[i]$testo[/i]
\r\n";
$message .= "è arrivato al mio DB.
\r\n"; //scrivi quello che vuoi
$from = "tua_e-mail"; //Il $cc se vuoi puoi ometterlo, io lo uso come verifica
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";
$headers .= "From: " . $from . "\r\n";
$headers .= "CC: " .$cc . "\r\n";
$invio_conferma = mail($to, $subject, $message, $headers);
if ($invio_conferma)
{
echo("
E-mail inviata correttamente a:[b]$email[/b]
");
echo $message;
//come vedi qui stampo il messaggio a video.
}else{
echo("Contattare WebMaster");
}
//header("refresh:2 url=tua_pagina.php");
?>
<?php
//-stampo il messagio--------------------------------------------------------------------------------
echo('Registrazione avvenuta,
Iscrzione avvenuta corrattamente, attendi 4 secondi e sarai reindirizzato alla Homepage
');
echo '<meta http-equiv="refresh" content="4;url=http://www.xxxx.com/index.php">';
?>