patfee Posted November 2, 2008 Share Posted November 2, 2008 Hi, i completely lost on how i could establish the following On page1.php i would like to have a couple of checkboxes the checkbox values should initially be storred within a session variable (array) when the checkbox status changes, these session variable should be updated. i would like to avoid the "post" method. many thanks for your advise! rgds Patrick Quote Link to comment https://forums.phpfreaks.com/topic/131108-checkbox-to-session-variable-without-post/ Share on other sites More sharing options...
dejangex Posted November 2, 2008 Share Posted November 2, 2008 You cound use ajax and call the checkbox_set.php?check1=1&check2=0&check3=1... whenever there are any changes to the checkboxes. In checkbox_set.php you would analize the GET string and do something like: if ($_GET['check1'] == 1 || $_GET['check1'] == 0) $_SESSION['check1'] = $_GET['check1']; In case I got ur question right, you wanted to use sessions and without post? This way you could modify $_SESSION variables. Quote Link to comment https://forums.phpfreaks.com/topic/131108-checkbox-to-session-variable-without-post/#findComment-680706 Share on other sites More sharing options...
patfee Posted November 2, 2008 Author Share Posted November 2, 2008 Thanks for your reply Im still lost on your approach actually. let me try to be more clear. on my page im trying to have one <div> tag with content generated from a database. the content from the database is dependant on the status of the checkboxes. I.e. with the checkboxes you can filter on some database fields. The checkboxes are contained by an other <div> tag. Changing one checkbox, should update the output from the database right away to make it more interactive. I'm now using ?check1=1&check2=0&check3=1.... to post the values nut Eventually, there will be lets say 50+ checkboxes so i would like to develop a clean and efficient solution. my idea was to store the checkbox values in an session array. thanks Patrick Quote Link to comment https://forums.phpfreaks.com/topic/131108-checkbox-to-session-variable-without-post/#findComment-680713 Share on other sites More sharing options...
RichardRotterdam Posted November 2, 2008 Share Posted November 2, 2008 readup on ajax articles it should solve your problem Quote Link to comment https://forums.phpfreaks.com/topic/131108-checkbox-to-session-variable-without-post/#findComment-680718 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.