I am capturing a month in my database and the value (integer) is being recorded but when I try to add the selected to the drop down so when the user comes back it reflects the month I can't figure out what I need to set the drop down to reflect the integer value that was previously submitted. If someone can share what i am missing in my selected code I would really appreciate it.
$months = array(
1=>'January',
2=>'February',
3=>'March',
4=>'April',
5=>'May',
6=>'June',
7=>'July',
8=>'August',
9=>'September',
10=>'October',
11=>'November',
12=>'December'
);
$birth_date_month = get_the_author_meta( 'birth_date_month', $user->ID );
<?php
foreach ( $months as $num => $month ) {
printf('<option value="%u">%s</option>', $num, $month, selected( $birth_date_month, $num, false ) );
}
?>
birth_date_month
would be from the code you've given, the save code would be necessary. But since you have access to the code, could you not just doecho $birth_date_month
and look? – Tom J Nowell♦ Feb 16 at 0:47