Jump to content

Dropdown


Xtremer360

Recommended Posts

I'm trying to have it shows the data from my array as each option will have a value of the user's id and the text for the option will be their name. As of right now it only shows the last person.

 

 


<?php echo form_label('Recipient', 'recipient'); ?>

<?php 
$data = array(
  'name'   => 'to',
  'class'  => 'required'
);
<?php echo form_label('Recipient', 'recipient'); ?>
                                    <?php 
                                    $data = array(
                                    'name'   => 'to',
                                    'class'  => 'required'
                                    );
                                    $options = array();
foreach($users AS $user)
{
    $options = array (
    $user->user_id => $user->first_name.' '.$user->last_name
    );     
}   
?>

<?php echo form_dropdown($data, $options); ?>

 

Link to comment
https://forums.phpfreaks.com/topic/258852-dropdown/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.