Good evening,
I am trying to make a script to add stores.
This is purely PHP and with no mySQL.
I have a table with stores items and the amount of the items, I would like it so that when I add stores they will list on the table and create a file with information, which I have done already.
The problem:
On the far column though I would like an 'onclick' plus or minus that would store the amount of the items and show on the main table page.
Basically I am talking of an onclick counter that would increase or decrease the amount of 'item.'
This would have to be done for each individual item.
<?php
if(!file_exists('counter.txt')){
file_put_contents('counter.txt', '0');
}
if($_GET['click'] == 'yes'){
file_put_contents('counter.txt', ((int) file_get_contents('counter.txt')) + 1);
header('Location: ' . $_SERVER['SCRIPT_NAME']);
die;
}
elseif($_GET['click'] == 'no'){
file_put_contents('counter.txt', ((int) file_get_contents('counter.txt')) - 1);
header('Location: ' . $_SERVER['SCRIPT_NAME']);
die;
}
<a href="?click=no"><img src="/minus.GIF" border="0"></a>
<a href="?click=yes"><img src="/minus.GIF" border="0"></a>
?>
That's pretty much it but I would like to be able to do it multiple times on the same page which would involve having an individual text file for each item of stores, which is fine as it's 1kb per file.
These will all be viewed on the same page also.
Help is greatly appreciated.
I am confused about a way ahead for this and would appreciate any tips or advice.
Regards,
Shugs