Xtremer360 Posted September 30, 2010 Share Posted September 30, 2010 Anything wrong with this because I got a parse error ONLY after adding to create this. <?php $visible = array('Yes', 'No'); foreach($visible as $visible): $visible2 = array('yes', 'no'); foreach($visible2 as $visible2): ?> Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted September 30, 2010 Author Share Posted September 30, 2010 Here's the whole select tag. The idea is to have the value of the options be yes and no but for it to show Yes and No to the user to select either. <select name="visible" class="dropdown"> <option value="0">- Select -</option> <?php $visible = array('Yes', 'No'); foreach($visible as $visible): $visible2 = array('yes', 'no'); foreach($visible2 as $visible2): ?> <option value="<?php echo $visible2; ?>"<?php if($visible == $row['visible']): echo ' SELECTED'; endif; ?>><?php echo $visible; ?></option> <?php endforeach; ?> </select> Quote Link to comment Share on other sites More sharing options...
Pawn Posted September 30, 2010 Share Posted September 30, 2010 $options = array( // option_val => display_text "yes" => "Yes", "no" => "No" ); foreach($options as $key => $val) { echo "<option value=\"".$key."\""; if($key == $row['visible']) echo " selected=\"selected\""; echo ">".$val."</option>\n"; } Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted September 30, 2010 Author Share Posted September 30, 2010 Thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.