WordPress.org

Ready to get started?Download WordPress

Forums

How to code Dropdown Menu for profile.php? (2 posts)

  1. antoniamar
    Member
    Posted 8 years ago #

    I'm a total novice but I've managed to successfully add custom fields to the user profile page except dropdown menus. For example, I want the user to select their age range. I can't get the selected info from the dropdown to save to the profile (the other custom input fields save fine). What is the proper way to code the dropdown? I've tried several different ways trying to follow other examples. Any help will be greatly appreciated. This is what I have now:
    <tr>
    <th scope="row"><?php _e('Age:') ?></th>
    <td>
    <select name="newuser_age" id="newuser_age">

    <option value="under 18"<?php echo $profiledata->user_age ?>>under 18</option>
    <option value="18-24"<?php echo $profiledata->user_age ?>>18-24</option>
    <option value="25-34"<?php echo $profiledata->user_age ?>>25-34</option>
    <option value="35-44"<?php echo $profiledata->user_age ?>>35-44</option>
    <option value="45-54"<?php echo $profiledata->user_age ?>>45-54</option>
    <option value="55-64"<?php echo $profiledata->user_age ?>>55-64</option>
    <option value="65
    or over"<?php echo $profiledata->user_age ?>>65
    or over</option>
    <option value="65
    or over"><?php echo $profiledata->user_age ?></option>

    </select></td>
    </tr>

  2. Dgold
    Member
    Posted 8 years ago #

    Hey, sorry I don't know the answer but, I recently got the Custom Fields GUI plugin. It allows you to make drop-down custom fields in Write Post. Maybe you can copy something from that.

Topic Closed

This topic has been closed to new replies.

About this Topic