jeudi 29 janvier 2015

Keep the check in checkbox on page reload

I have the form:



foreach($array as $c){
echo '<tr><td>';
echo '<input type="checkbox" name="check[]" value="'.$c.'"';

if(isset($_POST['check'])){
echo 'checked="checked"';
}

echo '>';
echo '</td></tr>';
}


I want to keep the check mark in the same checkbox on page reload(in case an error occured).The problem is that this script checks all checkboxes , instead of checking only the one that have been checked previously.





Aucun commentaire:

Enregistrer un commentaire