I have made several of these files all duplicates of one another with just destination, trigger and of course variables changed so they do not interact with each other the others work perfect and post the data without any problem but this one is giving me problems I have searched google more than once and I just can't find a solution so I hope that someone can help me here.
What is happening: when I click the save button it triggers the jquery to preform an ajax post to a php file. The php error log says that it is an undefined index:
[Tue Jan 15 18:39:25 2013] [error] [client] PHP Notice: Undefined index: edit_username in
the jquery
$(document).ready(function()
{
$('#hk_save').click(function(e)
{
e.preventDefault();
var formData3 = $('#master_lid').serialize();
submitdata(formData3);
});
});
function submitdata(formData3) {
$.ajax({
type: 'POST',
url: 'inc/system/save_lid.php',
data: formData3,
dataType: 'json',
cache: false,
async:false,
timeout: 7000,
success: function(data) {
alert(data.msg);
}
});
};
the php
include("./global2.php");
$error_message = "";
//Sanitize incoming data and store in variable
$username = trim(stripslashes(htmlspecialchars($_REQUEST['edit_username'])));
$mail = trim(stripslashes(htmlspecialchars($_REQUEST['edit_mail'])));
if(!empty($username))
{
$query = mysql_query("UPDATE users SET mail = '".$mail."'WHERE username = '".$username."' ");
$result ='Gebruiker "'.$username.'" is met success gewijzigd.';
}
else
{
$result = "Ow nee!, er heeft zich een error voorgedaan!";
}
$return['msg'] = $result;
echo json_encode($return);
exit;
and yes I have checked the fields for spelling errors and such and know they are correct.