this javascript:
"jform[username]": {
required: true,
minlength:5,
maxlength:15,
remote: "modules/mod_easiness_register/libs/elements/db_checker.php"
},
has to pass it’s value to this PHP script:
if (isset($_REQUEST['jform[username]'])) {
$username = $_REQUEST['jform[username]'];
$username = $mysqli->real_escape_string($username);
$check_for_username = $mysqli->query("SELECT username FROM $users WHERE username='$username'");
if (mysqli_num_rows($check_for_username)) {
echo "false";
} else {
echo "true";
}
}
the “”(quotes) around “jform[username]” are the trouble makers, but I have to use those quotes to make the brackets[] work (and I need those brackets as well). I think JSON can’t handle this. Do you know a way around this? I hope you understand the problem. Your help is much appreciated.
I think in your PHP script you should check for
$_REQUEST['jform']['username'], and this will solve your problem.