Linkz0rs
Member
- Messages
- 247
- Reaction score
- 7
- Points
- 18
Hello, I have a very simple question.
Could anyone help me out with trying to grab a users age from a database and properly outputting into declarations.
I'm trying to code my own profiling system for a website, and I'm a little confused on this process.
I already have the code to fetch the proper field in the database where it contains the users age, but what I cannot quite get is for it to then take the age from database in the format of "M-D-YYYY" into other declarations I have assigned:
And let me be very straight forward here, those are the NAMES that will be used for POST and such.
I want this to output in the said fields so if the user wishes to modify their DOB (or inputting their age upon registration), it will output it in the proper <select> field's I've created.
Here's what the <select> field looks like so you get the gist:
It would be preferred that the user cannot pick the default choice (labeled "- Month -" for example), nor can the user pick a non-realistic day (for example, only 28 days in Feb.)
Like how my B-Day is May, 19...
In the database, it would display as "May-19-1989".
Also, on the profile, I want it to also determine the age and outputting it, for example: "You are {age} years old".
I'm accomplishing this through ONE page (I do NOT want multiple pages for this, I'd prefer to do everything in just that one page and not making it take the user to another page [Like I've seen stuff like user login/register systems do]... ONE page, I already know how to make it read from the same page and process everything properly, I'm just confused on this one minor bit. Someone posting the code to accomplish such a task would be very appreciative.
Could anyone help me out with trying to grab a users age from a database and properly outputting into declarations.
I'm trying to code my own profiling system for a website, and I'm a little confused on this process.
I already have the code to fetch the proper field in the database where it contains the users age, but what I cannot quite get is for it to then take the age from database in the format of "M-D-YYYY" into other declarations I have assigned:
Code:
$DOBmonth (the month)
$DOBday (the day)
$DOByear (the year)
I want this to output in the said fields so if the user wishes to modify their DOB (or inputting their age upon registration), it will output it in the proper <select> field's I've created.
Here's what the <select> field looks like so you get the gist:
Code:
<select name='bdaymonth'>
<option value=''>- Month -</option>
<option value='Jan'>January</option>
<option value='Feb'>February</option>
<option value='March'>March</option>
<option value='April'>April</option>
<option value='May'>May</option>
<option value='June'>June</option>
<option value='July'>July</option>
<option value='Aug'>August</option>
<option value='Sep'>September</option>
<option value='Oct'>October</option>
<option value='Nov'>November</option>
<option value='Dec'>December</option>
</select>
<select name='bdayday'>
<option value=''>- Day -</option>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
<option value='6'>6</option>
<option value='7'>7</option>
<option value='8'>8</option>
<option value='9'>9</option>
<option value='10'>10</option>
<option value='11'>11</option>
<option value='12'>12</option>
<option value='13'>13</option>
<option value='14'>14</option>
<option value='15'>15</option>
<option value='16'>16</option>
<option value='17'>17</option>
<option value='18'>18</option>
<option value='19'>19</option>
<option value='20'>20</option>
<option value='21'>21</option>
<option value='22'>22</option>
<option value='23'>23</option>
<option value='24'>24</option>
<option value='25'>25</option>
<option value='26'>26</option>
<option value='27'>27</option>
<option value='28'>28</option>
<option value='29'>29</option>
<option value='30'>30</option>
<option value='31'>31</option>
</select>
<select name='bdayyear'>
<option value=''>- Year -</option>
<option value='2000'>2000</option>
<option value='2001'>2001</option>
<option value='2002'>2002</option>
<option value='2003'>2003</option>
<option value='2004'>2004</option>
<option value='2005'>2005</option>
</select>
Like how my B-Day is May, 19...
In the database, it would display as "May-19-1989".
Also, on the profile, I want it to also determine the age and outputting it, for example: "You are {age} years old".
I'm accomplishing this through ONE page (I do NOT want multiple pages for this, I'd prefer to do everything in just that one page and not making it take the user to another page [Like I've seen stuff like user login/register systems do]... ONE page, I already know how to make it read from the same page and process everything properly, I'm just confused on this one minor bit. Someone posting the code to accomplish such a task would be very appreciative.
Last edited: