• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Re-populate checkboxes

I have a form where a user fills in a reportform. The report is availible for edit, it retrieves the information from the database and shows the same form but with the previous information. However checkboxes and dropdownmenus are not re-populated, how do I make them set "automatically"?

Thank you

For checkbox
<input type='checkbox' value='2'<?php if($data['something']=='2'){?>checked<?php };?>>
For select
<option value=1>1</option>
<option value=2 &lt;?php if($data['something']=='2'){?&gt;checked&lt;?php }?&gt;>2</option>

If it doesnt work show ur source code

If you're using the form helper functions (form_dropdown, form_checkbox, etc) you can pass a default value to them that will automatically select/check the correct items.

nice information.. Thanx

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.