shugs Posted December 8, 2010 Share Posted December 8, 2010 Hi all, slightly confusing title! What I am trying to do is make a simple stores system whereby I can add and remove stores. It is purely php and no mySQL. My idea was to create a text file with the individual number and then include the file on the table on the page. I have worked out how to increment one value by one, but the others I am struggling with. Example I wish to have two links one which I click to increase and another to decrease the value by one. It's the multiple issue that is confusing me, I create a txt file and a php file using a variable from a submitted form (part number). The php file holds info and the text file holds the number which is default at '0' (Zero). My idea was to write some php to the file, perhaps when I click the plus it will open and write to the file + 1 .. Any guidance or points in the right direction would be greatly appreciated. Thanks. Shugs Quote Link to comment https://forums.phpfreaks.com/topic/221007-multiple-single-click-counters/ Share on other sites More sharing options...
Adam Posted December 8, 2010 Share Posted December 8, 2010 Updating the value is easy: // Get the current value and cast as an integer $counter = (int) file_get_contents('./counter.txt'); // Set the new value $counter++; // Store in file (overwrites current contents) file_put_contents('./counter.txt', $counter); It's the multiple issue that is confusing me .. Not sure what you mean by this though? Quote Link to comment https://forums.phpfreaks.com/topic/221007-multiple-single-click-counters/#findComment-1144388 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.