Ciao a tutti
ho creato un form che tramite javascript ( jquery ) prende le variabili di un form e le passa tramite POST
$.ajax({
data: "post",
url: "includes/ValidUserAdd.php",
data: dataString,
success: function() {
$('#widget2').append("<div id='message'></div>");
$('#message').html("<h2>Contact Form Submitted!</h2>").append("
We will be in touch soon.</p>")
.hide()
.fadeIn(1500, function() {
$('#message').append("[img]images/check.png[/img]");
});
}
});
ad una pagina ValidUserAdd.php che valida i campi e li passa ad un'altra pagina php dove viene eseguita la query.
Codice PHP:
require "classes/Mysql.php";
$mysql= New Mysql();
if ((isset($_POST['nome'])) && (strlen(trim($_POST['nome'])) > 0)) { $nome = stripslashes(strip_tags($_POST['nome']));}
if ((isset($_POST['cognome'])) && (strlen(trim($_POST['cognome'])) > 0)) { $cognome = stripslashes(strip_tags($_POST['cognome'])); }
if ((isset($_POST['citta'])) && (strlen(trim($_POST['citta'])) > 0)) { $citta = stripslashes(strip_tags($_POST['citta'])); }
if ((isset($_POST['email'])) && (strlen(trim($_POST['email'])) > 0)) { $email = stripslashes(strip_tags($_POST['email'])); }
if ((isset($_POST['username'])) && (strlen(trim($_POST['username'])) > 0)) { $username = stripslashes(strip_tags($_POST['username'])); }
if ((isset($_POST['password'])) && (strlen(trim($_POST['password'])) > 0)) { $password = stripslashes(strip_tags($_POST['password'])); }
$array_form = array("nome"=>'$nome',"cognome"=>"$cognome","citta"=>"$citta","email"=>"$email","username"=>"$username","password"=>"$password");
$mysql->useradd($array_form);
Il problema sta che non mi mette niente nel db.
:-(