Xtremer360 Posted January 13, 2011 Share Posted January 13, 2011 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 More sharing options...
Pikachu2000 Posted January 13, 2011 Share Posted January 13, 2011 You aren't asking it to echo the string. The string is in $key. Link to comment https://forums.phpfreaks.com/topic/224371-multidiminsional-arrays/#findComment-1159119 Share on other sites More sharing options...
Xtremer360 Posted January 14, 2011 Author Share Posted January 14, 2011 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. Link to comment https://forums.phpfreaks.com/topic/224371-multidiminsional-arrays/#findComment-1159132 Share on other sites More sharing options...
Pikachu2000 Posted January 14, 2011 Share Posted January 14, 2011 What value is stored in the database? Link to comment https://forums.phpfreaks.com/topic/224371-multidiminsional-arrays/#findComment-1159136 Share on other sites More sharing options...
Xtremer360 Posted January 14, 2011 Author Share Posted January 14, 2011 Well I have two entries one has 1 for the value and the other has 2 for the value. And by value I mean inside the privilages field. Link to comment https://forums.phpfreaks.com/topic/224371-multidiminsional-arrays/#findComment-1159190 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.