Saving Checkboxes

edmund81

New Member
Messages
48
Reaction score
1
Points
0
Hi,
I'm completely new to anything that is not html but I'm wondering if in something like php I can get a checkbox to permanently save through reloads and different machines. My idea was just to have a page with only a checkbox on it, and then load that through and iframe in html. If anybody could give me the code for that checkbox page (complete if possible as I don't really know anything about that type of programming) I would be very grateful.
Thank You
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
I won't give you teh codez, but will tell you what you need to work with. There's good laziness (getting a computer to do your work) and bad laziness (getting a person to do your work); right now, you're exhibiting the latter.

Data persistence is handled by things such as file systems and databases. A simple checkbox could be handled by storing the value in a file (you can generate a storable value using serialize, then unserialize it when retrieving), or you could use a basic DB such as SQLite or one based on Berkeley DB (via the DBA extension). A more full-fledged app would need a more complete database system, such as MySQL, PostgreSQL or SQL Server. For a tutorial on interfacing PHP and MySQL, try "Writing MySQL Scripts with PHP and PDO"; the same techniques can be easily adapted for other DBMSs that PDO has drivers for, such as SQLite and PostgreSQL. For more on why you should learn SQL, and where to do it, read the thread "Microsoft SQL Server (a rant)".

Ideally, data persistance should be handled in a separate layer so as to reduce coupling as a part of separation of concerns. There are many data persistence patterns available, though not all are suitable in certain (or, for some patterns, any) circumstances. Given how new this is to you, you needn't study persistence layers immediately. However, once you have a handle on SQL, you should return to the topic, using your current project as a study case.
 
Top