nvrong Posted April 7, 2008 Share Posted April 7, 2008 I'm completely new to PHP, but not programming. I intend to learn PHP soon, perhaps in the summer. I'd like to know how I would have say a blank HTML page except for 5 Checkboxs and a Submit button. Anyone who goes to this site can check or uncheck any number of checkboxs, and the next person to go onto that site will see the checkboxs that are already checked. For example... They all start off blank: [] [] [] [] [] [submit] then person A checks off box 2,3, and 5, so it would appear like this: [] [X] [X] [] [X] [submit] The next person to visit the site, person B, sees all the boxes person A checked off, and perhaps unchecks, or checks a few of his own, which the next person to visit the site could see. I have access to a mySQL database if that's needed, but i'd perfer if It was just in a flie like 'Checkboxs.txt' Can anyone give me the code on how to do this, or point me towards some already written code? Much appreciated, Nvrong Link to comment https://forums.phpfreaks.com/topic/100053-noob-question/ Share on other sites More sharing options...
kevin7 Posted April 8, 2008 Share Posted April 8, 2008 yes, you can do that... i don't have the time to write the code, but i can show you some guides... the following show you how to retrieve checkbox value and print it out. http://www.kirupa.com/web/php_contact_form3.htm the follwoing show you how to read and write into file http://www.gfx-depot.com/forum/-tutorial-index-t-1040.html so, basically, what you can do is, get the value, and modify the value into something like this 0#0#1#0 <--- 0=unchecked, 1=checked, #= separator (can be anything, empty space for example) so, you write that string to the file. if you wanna load the checkboxes' setting, just read from the file and explode it $chkbox = explode("#",$string); $string is the value you read from the file. so, you will able to set the value of the checkbox using if else statment or for loop... hope it will help... Link to comment https://forums.phpfreaks.com/topic/100053-noob-question/#findComment-511662 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.