I am presently using php to display a column of numbered checkboxes, one for each day of a given month and next to each I display a text box to enter optional notes for a given checked day. I wish to restrict the user to entering notes only for days checked by either showing/hiding the text box based on the adjacent checkbox state or toggling its disabled attribute. I use a php loop to display form elements for each day and checkboxes are named boxes[], text boxes are named comments[]. I am aware that I can discard unused input before inserting records into the database, but I do not want to leave the user with the impression that they can place notes that will be retained on days that are not selected.
while ($day_count <= $num_days){
echo"<input name='boxes[]' type='checkbox' value='".$prov_id."_".$day_count."' />".$day_count."</input>";
echo "Comment: <input name='comments[]' type='text' size='15' maxlength='255' />";
echo "<br>";
$day_count++;
}
Aucun commentaire:
Enregistrer un commentaire