Hi..! I am a fresher! Now 1ly I am started to learning php. I need to check some of the check box default in current form which was already selected in the previous form. For example, if i was select 3 of the check box among 5 check boxes , I need to show these three of the check box in checked condition and the remaining two will be unchecked..! I don't know how to express my doubt clearly..!Anyhow If anyone can understand my doubt means pls help me by send some sample codings..! Thank u..!
Um, would you be able to explain this better ? Sorry just can't understand exactly what you need help with.
If you use PHP you need to get the value in this way; if(isset($_POST['checkbox'])) $checked = " CHECKED"; else $checked = ""; echo '<input type="checkbox" name="checkbox"'.$checked.'>'; Code (markup): This is not tested so might need a little fixing. Of course you then need to make it work with the 5 check boxes
If you were to use the above code. Here is it with the result outside the php tags which would be helpful if you are putting it directly into another form. <?php if(isset($_POST['checkbox'])) { $checked = "on"; } else { $checked = ""; } ?> <input type="checkbox" name="checkbox" value="<?php echo $checked; ?>" /> Code (markup):