Welcome Guest, Not a member yet? Register   Sign In
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

Theme © iAndrew 2016 - Forum software by © MyBB