A JavaScript function using xmlhttp is shown below:
var params = "a=" + encodeURIComponent(a)
+ "&b=" + encodeURIComponent(b)
+ "&c=" + encodeURIComponent(c);
var url = "noob.php";
xmlHttp2.open("POST", url, true);
xmlHttp2.onreadystatechange = stateChanged2;
xmlHttp2.send(params);
Here is the code for noob.php:
<?php
include('config.inc.php');
include('database.inc.php');
$a = mysql_real_escape_string($_POST['a'], $con);
$b = mysql_real_escape_string($_POST['b'], $con);
$c = mysql_real_escape_string($_POST['c'], $con);
mysql_query("INSERT INTO users (inchat,preference) values('N','$a$b$c');");
echo mysql_insert_id();
mysql_close($con);
?>
I have tested all the code of noob.php with a html form and it works fine. The issue may be related to:
xmlHttp2.onreadystatechange = stateChanged2;
xmlHttp2.send(params);
The parameter sending process failed, unfortunately I am not sure how to test this
The string sent might not be recognized by noob.php due to possible formatting issues
The problem arises from the fact that the parameter is not being inserted into the table. So which of the above possibilities could be the cause?