0

I'm trying to do a mysql query in php. One of my data is a variable from javascript. I managed as follows. Echo returns the correct value, but I do not understand why the query does not want to be executed. How can I fix this?

...
    $value = "<script>document.write(localStorage.getItem('sumalist'));</script>";
    echo $value; // yes, value is correct

    if ($polaczenie->query("INSERT INTO zamowienia VALUES ('$value')"))
    $_SESSION['udanezamowienie'] = "Zamówienie zostało wysłane!!";
...
A. Jo
  • 15
  • 5
  • $value is going to be a js string, i dont think thats what you want –  Jul 04 '18 at 21:43
  • `$value` returns the value I want to add to the sql query, but it does not want to execute. – A. Jo Jul 04 '18 at 21:56
  • no it dosn't, its just because you're running this in a browser which will evaluate the js. –  Jul 04 '18 at 22:13

0 Answers0