Skip to content Skip to sidebar Skip to footer

Show Checkbox Checked In The Table

I have a problem showing the selected check value in the table. Now I cannot follow my selected value to show the check values in each row in the table. For example below coding,

Solution 1:

In your code there is $tick value every time the same, for all checkboxes.

If you have tick values in array, than it's quite easy. In each row check $myArray[X] value.

<td><inputtype="checkbox"id="checkbox_val"name="checkbox_val"value="0"<?phpecho$myArray[0] === 'true' ? 'checked' : '';?>>&nbsp;</td>

You can do it in loop, than code would be st. like (expected you have contact&country in any array too)

<table><tr><th>....</th></tr><?phpforeach ($myArrayas$k => $va) { 
?><tr><td>...</td><td><inputtype="checkbox"id="checkbox_val"name="checkbox_val"value="0"<?phpecho$va === 'true' ? 'checked' : '';?>>&nbsp;</td><td><?phpecho$contact[$k] ?></td><td><?phpecho$country[$k] ?></td></tr><?php    
}
?></table>

Post a Comment for "Show Checkbox Checked In The Table"