hello
I have checkbox to display the months .Is good in the insert form But in the update form I want the months that have been checked in the insert form ,have checked in the update form
i used this code to dispaly check boc

<?php foreach ($months as $key => $value) { ?> 
  
              <input type="checkbox" name="months[]" id="months" value="<?php echo $key; ?>" style="text-align:right; direction:rtl; ">  
<?php } ?>

Recommended Answers

what about checked? Something like:

<?php foreach ($months as $key => $value) { ?> 
	<input type="checkbox" name="months[]" id="months" value="<?php echo $key; if(this_is_selected_somehow){echo ' checked'} ?>" style="text-align:right; direction:rtl; ">  
<?php } ?>
Jump to Post

All 4 Replies

what about checked? Something like:

<?php foreach ($months as $key => $value) { ?> 
	<input type="checkbox" name="months[]" id="months" value="<?php echo $key; if(this_is_selected_somehow){echo ' checked'} ?>" style="text-align:right; direction:rtl; ">  
<?php } ?>

I want thing like this at update form

[ ]jan
[x]feb
[x]marc
[ ]april

did you understand what I wrote above. It have that answer

I tested it but there's no changes

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.