PHP is executed on the server side, while javascript is executed on the client side; if you want a value from javascript to be sent to PHP, you will need to write up some kind of script to pass the data, via AJAX, GET, etc.
edit: database != data
0
solved php, string to int