I'm having a problem when I'm trying to serialize data form.
Here is the code. I have a page1.php that contains the form. And when the form has been sent, through AJAX, I retrieve the form data and then send it to page2.php.
The problem appears, when it's trying to serialize the file field.
page1.php (containing the form)
$(document).ready(function(){
$("#enviar").click(function(e){
e.preventDefault();
$.ajax({
type: "POST",
url: "processar_updateUser.php",
data: $("form").serialize(),
success: function(data){
alert(data);
}
});
return false;
});
});
page2.php (processing the form data)
<?php
$personal_name = addslashes(htmlentities($_POST['personalname']));
$name = addslashes(htmlentities($_POST['name']));
$surname = addslashes(htmlentities($_POST['surname']));
$concatnom = $name.".".$surname;
$password = addslashes(htmlentities($_POST['password']));
$adegree = addslashes(htmlentities($_POST['adegree']));
$initials = addslashes(htmlentities($_POST['initials']));
$n = substr($name,0,1);
$c = substr($surname,0,1);
$initials = $n.$c;
$email = addslashes(htmlentities($_POST['email']));// que sigui cadena+@"+cadena+.+cadena
$telephone = addslashes(htmlentities($_POST['telephone'])); //numero y nomes 9
$signature = addslashes(htmlentities($_FILES['signature']['name']));//i have used $_POST, but dind't work
?>