Sinisterly
What's the best way to store dates using html select fields? - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: PHP (https://sinister.ly/Forum-PHP)
+--- Thread: What's the best way to store dates using html select fields? (/Thread-What-s-the-best-way-to-store-dates-using-html-select-fields)

Pages: 1 2


What's the best way to store dates using html select fields? - AkarMathers13 - 08-14-2014

Hello Guys, I have a question, Just like the title says, What's the best way to store dates in the database using select fields and a PHP script? I use it for registration. Here is my HTML code:

Code:
<p>Birthday:<select name="birthday"> <option value="1">Jan</option> <option value="2">Feb</option> <option value="3">Mar</option> <option value="4">Apr</option> <option value="5">May</option> <option value="6">Jun</option> <option value="7">Jul</option> <option value="8">Aug</option> <option value="9">Sep</option> <option value="10">Oct</option> <option value="11">Nov</option> <option value="12">Dec</option> </select> <select name="birthday"> <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="birthday"> <option value="2011">2011</option> <option value="2010">2010</option> <option value="1905">1905</option> </select></p>


Thanks!


What's the best way to store dates using html select fields? - AkarMathers13 - 08-14-2014

Hello Guys, I have a question, Just like the title says, What's the best way to store dates in the database using select fields and a PHP script? I use it for registration. Here is my HTML code:

Code:
<p>Birthday:<select name="birthday"> <option value="1">Jan</option> <option value="2">Feb</option> <option value="3">Mar</option> <option value="4">Apr</option> <option value="5">May</option> <option value="6">Jun</option> <option value="7">Jul</option> <option value="8">Aug</option> <option value="9">Sep</option> <option value="10">Oct</option> <option value="11">Nov</option> <option value="12">Dec</option> </select> <select name="birthday"> <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="birthday"> <option value="2011">2011</option> <option value="2010">2010</option> <option value="1905">1905</option> </select></p>


Thanks!


RE: What's the best way to store dates using html select fields? - Singularity_mybb_import13102 - 08-14-2014

If you could elaborate, I should be able to help you. There are several different types of databases. What are you using, what's the table name, what's the description of said table, etc


RE: What's the best way to store dates using html select fields? - Singularity_mybb_import13102 - 08-14-2014

If you could elaborate, I should be able to help you. There are several different types of databases. What are you using, what's the table name, what's the description of said table, etc


RE: What's the best way to store dates using html select fields? - Ex094 - 08-14-2014

Ahh I got ya problem, I think this might be yer solution http://rijamedia.com/blog/2011/02/dynamic-date-dropdown-select-menu-in-php/


RE: What's the best way to store dates using html select fields? - Ex094 - 08-14-2014

Ahh I got ya problem, I think this might be yer solution http://rijamedia.com/blog/2011/02/dynamic-date-dropdown-select-menu-in-php/


RE: What's the best way to store dates using html select fields? - AkarMathers13 - 08-14-2014

@Singularity MySQL Database, And a users table.


RE: What's the best way to store dates using html select fields? - AkarMathers13 - 08-14-2014

@Singularity MySQL Database, And a users table.


RE: What's the best way to store dates using html select fields? - Singularity_mybb_import13102 - 08-14-2014

@AkarMathers13
Login to MySQL and give me the output of:
use databasenamehere;
desc usertablenamehere;

I need to know what rows/columns there are, where to store the information, etc...
Have you ever even implemented a database, how do you have a user table and not know how to add a date? Have you not added users either?
I'm just trying to help here, but I still need more information.


RE: What's the best way to store dates using html select fields? - Singularity_mybb_import13102 - 08-14-2014

@AkarMathers13
Login to MySQL and give me the output of:
use databasenamehere;
desc usertablenamehere;

I need to know what rows/columns there are, where to store the information, etc...
Have you ever even implemented a database, how do you have a user table and not know how to add a date? Have you not added users either?
I'm just trying to help here, but I still need more information.