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

#1
[eluser]zxcv[/eluser]
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
zxcv

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

If it doesnt work show ur source code

#3
[eluser]Kamarg[/eluser]
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.

#4
[eluser]Unknown[/eluser]
nice information.. Thanx


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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