Jump to content

Multidiminsional Arrays


Xtremer360

Recommended Posts

Its displaying the values but not the String Text for the option tag. I know I have somethign wrong not sure what.

 

<?php
                    $privilages = array('All Users' => 0, 'Admins Only' => 1);
                    foreach($privilages as $key => $pl):
                ?>        
                <option value="<?php echo $pl; ?>"><?php echo $pl; ?></option>
             
             <?php endforeach; ?>

Link to comment
https://forums.phpfreaks.com/topic/224371-multidiminsional-arrays/
Share on other sites

Thank you but..

 

What if for the edit check I have this

 

<?php
                    $privilages = array('All Users' => '1', 'Admins Only' => '2');
                    foreach($privilages as $key => $pl):
                ?>        
                <option value="<?php echo $pl; if($pl == $row['privilages']) { print " SELECTED"; }?>"><?php echo $key; ?></option>
             
                <?php endforeach; ?>

 

In the console response it shows which value is the selected but doesn't show it in the key.

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.