I am using html5 local storage and I am trying to read it and pass it to a php variable:
This is the code:
$myphpvar = "<script>document.write(localStorage.getItem('myjsvar'));</script>";
When I do this:
echo $myphpvar;
The value looks right (at leave visually)
Upto there all looks good BUT when I add this code:
$sql="INSERT INTO `pending` (`id`, `myfield`) VALUES ('', '$myphpvar')";
I then get this error:
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ..
The error points here:
$myphpvar = "<script>document.write(localStorage.getItem('myjsvar'));</script>";
Any ideas why?