I have a html page:
<form action="stock.php" method="post">
S:<input value="remove" name="removeWS" type="submit" /> </br>
M:<input value="remove" name="removeWM" type="submit" /> </br>
L:<input value="remove" name="removeWL" type="submit" /> </br>
I am wanting a php page to make do
var quantity_in_stock_S = 2
var quantity_in_stock_M = 2
var quantity_in_stock_L = 1
when removeWS is clicked:
1 - var quantity_in_stock_S
That kind of idea...
$f = fopen("1stock.js", "a+");
fwrite(...); /* 1 - quantity_in_stock_S*/
Declare the variables in the HTML page, insert some PHP where you pull the data from the database.
In the PHP you should update the value in the database to the new value.
var quantity_in_stock_S = <?=$row['quantity_s']?>
var quantity_in_stock_M = <?=$row['quantity_m']?>
var quantity_in_stock_L = <?=$row['quantity_l']?>
Suggest you use AJAX to make a query to a PHP script that then reads the file/database and returns the data requested.