• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem drop -down dynamically

#4
If you're new to PHP programming and CodeIgniter, you better learn to do it the right way!

Get the data from a model and return an array in the format expected by the form_dropdown function.
Example of the format expected:
PHP Code:
$options = array(
 
       'small'         => 'Small Shirt',
 
       'med'           => 'Medium Shirt',
 
       'large'         => 'Large Shirt',
 
       'xlarge'        => 'Extra Large Shirt',
); 

And in your view, create the dropdown list with the form_dropdown helper function:
http://www.codeigniter.com/userguide3/he...m_dropdown


PHP Code:
echo form_dropdown('shirts'$options'large'); 

Loading data directly in the controller is bad design and bad practice. Reinventing the wheel to create a dropdown list is also bad practice. I strongly suggest you read the user guide to learn all the features availble in CodeIgniter to make your life easier.
Test your translation files with Translation Tester
Reply


Messages In This Thread
problem drop -down dynamically - by Delta-51 - 05-29-2015, 11:24 AM
RE: problem drop -down dynamically - by Athov - 05-30-2015, 05:07 AM
RE: problem drop -down dynamically - by includebeer - 05-30-2015, 11:02 AM
RE: problem drop -down dynamically - by Delta-51 - 05-31-2015, 11:51 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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