justravis Posted September 6, 2007 Share Posted September 6, 2007 I am trying to write a function that will recheck a checkbox if it was checked when submitted. The problem is the checkbox array only includes checkboxes with a value, so the order of the checkbox array changes. For example, if I only check 1 random checkbox, it will only check the first checkbox. Any ideas on a workaround? How would you handle such a situation? Thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/68273-solved-php-preserving-checkbox-key-even-when-all-arent-checked/ Share on other sites More sharing options...
Jessica Posted September 6, 2007 Share Posted September 6, 2007 They should have different values. On each one, do if the value is equal to the selected value, make it selected. We'd have to see the code to help more than that. Quote Link to comment https://forums.phpfreaks.com/topic/68273-solved-php-preserving-checkbox-key-even-when-all-arent-checked/#findComment-343276 Share on other sites More sharing options...
justravis Posted September 6, 2007 Author Share Posted September 6, 2007 Jeni, I've been experimenting all day, but checking the value instead of the key FINALLY hit me shortly after posting. I wanted to go back to the drawer board before declaring this topic SOLVED. Thanks again! You have been very helpful on a variety of topics now. Quote Link to comment https://forums.phpfreaks.com/topic/68273-solved-php-preserving-checkbox-key-even-when-all-arent-checked/#findComment-343298 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.