Jump to content

Recommended Posts

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 }} ?> 

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.