- This topic is empty.
January 28, 2019 at 10:01 am #281917
I’m attempting to recreate this: http://rinchencholing.org/#whitetara
Which allows to submit numeric values and automatically update and display the total number of sumbmited values. I know how to create the form, but I don’t know how to store entered values and update the total accordingly.February 2, 2019 at 12:11 am #282180
You can use PHP’s file_put_contents() to save the entered form values into a text file. Then you can retrieve the content of the text file and display them on the page with file_get_contents() and echo()
Here’s a simple demo that uses the same logic except it’s updating a stylesheet http://fofwebdesign.co.uk/template/_testing/test/save-file/index.phpFebruary 4, 2019 at 1:45 pm #282254
Thank you!!! and what is that the best way to store values so that is easier to view/check and edit the submissions? maybe storing it in a table or excel? or like a post in wordpress? the website is running on wordpress…February 4, 2019 at 10:47 pm #282270
A database table is also another option, then you could edit entries via something like phpMyAdmin in your web host control panel, or you could make your own admin panel. It just depends how much effort you want to put in.
There are PHP database management scripts out there such as https://www.adminer.org and http://phpminiadmin.sourceforge.net for you to edit an existing database but you’d have to devise the structure and write the code for the web page to communicate with the backend.
Alternatively, you could try a ready-made form and database management application such as Form Tools, which handles form-to-db communication and stores submissions separately, where you can edit via a backend admin panel and export into Excel https://formtools.org
You would need to research more to test capabilities and see what suits your needs.February 15, 2019 at 5:13 pm #282951
Thanks again!! I’m not sure whats best. What if I use a CSV or a regular html table? which are easy to edit/check and not as complex as mysql perhaps.
If those are good choices.. how to write to the right column/row for the table or the CSV file?February 16, 2019 at 12:49 am #282961
Editing rows: To find out more about targeting individual rows/lines in a single text/csv file, Google something like “php edit specific line in text file” to begin your research – it usually involves reading the lines of a text file into memory and numbering them along the way. OR, you can store each row/line in its own text file, and the file name could be the row identifier (rather than the line number from a single larger file stored in memory).
Editing columns: if you use a delimiter (e.g. ”##”) to separate cell data in each column, you can use
explode()in PHP to separate the data at that delimiter when you retrieve it, then you can use
implode()and the same delimiter to join the column data back together when you save it again.
When assessing what’s good for your project, only you can make that assessment I’m afraid. You might have to try out/research several solutions until you come up with something that fits your needs/scale/time/budget/skill, etc.
- The forum ‘Back End’ is closed to new topics and replies.