Created
July 23, 2013 06:06
-
-
Save jnowland/6060199 to your computer and use it in GitHub Desktop.
Select boxes for birthday in freemember echos out bday_d , bday_m, bday_y for expression engine. Works with PHP on output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="control-group"> | |
<label for="{pr_form_id}-date-of-birth">Date of Birth</label> | |
<select id="{embed:form_prefix}-bday_d" name="bday_d" class="dob-day"> | |
<option value="">Day</option> | |
<?php for ($i=1; $i < 32; $i++) : ?> | |
<option value="<?php echo $i ?>" | |
<?php echo ($i == "{bday_d}") ? 'selected="selected"' : "" ?> | |
> | |
<?php echo $i ?></option> | |
<?php endfor; ?> | |
</select> | |
<select id="{embed:form_prefix}-bday_m" name="bday_m" class="dob-month"> | |
<option value="">Month</option> | |
<?php foreach(array('January','February','March','April','May','June','July','August','September','October','November','December') as $k => $i) : ?> | |
<option | |
value="<?php echo ($k+1) ?>" | |
<?php echo (($k+1) == "{bday_m}") ? 'selected="selected"' : "" ?> | |
> | |
<?php echo $i ?> | |
</option> | |
<?php endforeach; ?> | |
</select> | |
<select id="{embed:form_prefix}-bday_y" name="bday_y" class="dob-year"> | |
<option value="">Year</option> | |
<?php | |
$max_age = 100; | |
$min_age = 1; | |
$current = date('Y'); | |
?> | |
<?php foreach (range($min_age,$max_age) as $year) : ?> | |
<option | |
value="<?php echo ($current - $year) ?>" | |
<?php echo (($current - $year) == "{bday_y}") ? ' selected="selected" ' : "" ?> | |
> | |
<?php echo ($current - $year) ?> | |
</option> | |
<?php endforeach; ?> | |
?> | |
</select> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Will you include filter for leap year?