• So I need help creating a dropdown menu for my register button on my buddypress site.

    The dropdown menu will be for age but only 18+ users only. What I have is below.

    So I want the dropdown to include numbers 18 all the way to 99.

    Code I have so far

    <div class="dropdown">
            <button onclick="myFunction()"
    class=”dropbtn”>Dropdown</button>
    	<div id=”Age” class =dropdown-content”>
    	//Something goes here I think?
    </div>
    </div>

    Is this the correct way about doing this?

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Isn’t the select element exactly what you want?

    Thread Starter 2tyerd

    (@2tyerd)

    <select?name="Age">
    ????<option?value="None selected">Please select below</option>
    ????<option value="18">18</option>
    ????<option value="19">19</option>
    ????<option value="20">20</option>
        <option value="21">21</option>
        etc etc
    </select>

    Something like this?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Yes you can look through to make it easier;

    <select>
    
        <?php for (i = 18; i < 100; i++ ) { ?>
        <option value="<?php echo $i ?>"><?php echo $i ?></option>
        <?php } ?>
    </select>

    Was that your question?

    Thread Starter 2tyerd

    (@2tyerd)

    Not really. but its because I wasn’t clear enough.

    This is the a portion of the code right now for my register form. Its for the username, email, password and email.

    <div class="six columns">
            <input type="text" id="reg-username" name="signup_username" class="inputbox" required placeholder="<?php _e("Username", 'kleo_framework');?>">
          </div>
          <div class="twelve columns">
            <input type="text" id="reg-email" name="signup_email" class="inputbox" required placeholder="<?php _e("Your email", 'kleo_framework');?>">
          </div>
          <div class="six columns">
            <input type="password" id="reg-password" name="signup_password" class="inputbox" required placeholder="<?php _e("Desired password", 'kleo_framework');?>">
          </div>
          <div class="six columns">
            <input type="password" id="confirm_password" name="signup_password_confirm" class="inputbox" required placeholder="<?php _e("Confirm password", 'kleo_framework');?>">
          </div>

    In this same form I want to have a dropdown menu where you select your age because it didn’t come included in the theme. The age options being from 18-99.

    I thought a div tag would be enough since all the other fields also use div tags. I’m very new to coding.

    Thanks for your help

    Regards

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Oh you’ll need some way of processing this new age field in BBPress, so I recommend posting for support here: https://bbpress.org/forums/

    Thread Starter 2tyerd

    (@2tyerd)

    thanks ill post it there

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Code for dropdown menu for buddypress register form’ is closed to new replies.