Xtremer360 Posted June 5, 2011 Share Posted June 5, 2011 I'm trying to get it to put the style_name for the LI but it is not. <?php while ($row = mysqli_fetch_array($characterstylesResult, MYSQLI_ASSOC)) { print "<optgroup label=\"** ".$row['style_name']." **\">"; $charactersResult = mysqli_query($dbc, " SELECT characters.id, characters.character_name FROM characters WHERE id NOT IN (SELECT character_id FROM user_characters) AND characters.character_style_id = ('" . $row['id'] . "') ORDER BY characters.character_name"); while($row = mysqli_fetch_array($charactersResult)) { echo "<option value=\"".$row['id']."\"> " . $row['character_name'] . "</option>\r"; } print "</optgroup>"; } ?> </select> <input type="button" value="Add Character" class="" onclick="add_user_character()"/> <ul id="character_list"> <?php mysqli_data_seek( $userResult, 0 ); while($row = mysqli_fetch_array ( $userResult, MYSQL_ASSOC )) { if ($row['character_name'] == NULL ) { } else { ?> <li character_style="<?php echo $row['style_name']; ?>" character_id="<?php echo $row['id']; ?>" character_name="<?php echo $row['character_name']; ?>"><?php echo $row['character_name']; ?> <a href="#">Remove</a></li> <?php }} ?> Quote Link to comment https://forums.phpfreaks.com/topic/238428-optgroup/ 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.