Stats: 3,185,975 members, 7,927,914 topics. Date: Thursday, 22 August 2024 at 04:15 AM |
Nairaland Forum / Science/Technology / Webmasters / How To Create Birthday Table/form In Php And Mysql? (4095 Views)
Creating An Alumni Site With Php And Mysql / Form Validation Tutorial Using Javascript, Php And Ajax! / Writing A Time Based Expiration Script Or Function Using Php And Mysql (2) (3) (4)
How To Create Birthday Table/form In Php And Mysql? by chrishenzo: 6:59am On Dec 08, 2010 |
Hello php and mysql professionals, I'm building a website that has a user registration form. I have designed the complete form and created mysql table for it. Every thing is working perfectly. But I have some issues. The user registration form needs users to enter their date of birth. I created the column for it in the datebase but it doesn't work. So I separated it like this ageday agemonth ageyear, and it is working perfectly but I don't like the looks. I want everything to be in one column. For example, the name of the column would be birthday, then when the user submit the registration form, it will appear like 21-05-1950 under the birthday column. How can I do that. Your help is needed. Thank you. |
Re: How To Create Birthday Table/form In Php And Mysql? by sayhi2ay(m): 3:54pm On Dec 08, 2010 |
what are your input fields? and how is the date appearing currently ? |
Re: How To Create Birthday Table/form In Php And Mysql? by yawatide(f): 6:24pm On Dec 08, 2010 |
Every thing is working perfectly. But I have some issues. ![]() ![]() ![]() Anyways, there are many ways to skin a cat. I would probably create a birthday column in my table should be of data type "text (or whatever it is)", then for your form, you should have, preferably, 3 dropdowns: day (1-31), month (1-12) and year (you determine the range). Preferably as well, all these numbers should be generated via a loop. On your form processing page, you concatenate the 3 fields in the date form of your choice (say, Y-m-d) then you insert it into your birthday column. to retrieve, you obtain the value of the field and pass into the php date function to display in the format of your choice. I hope this helps. good luck! |
Re: How To Create Birthday Table/form In Php And Mysql? by chrishenzo: 12:26am On Dec 09, 2010 |
sayhi2ay: Thank you for your concern. Actually, I created three columns for age i.e dayofbirth, monthofbirth and yearofbirth. On the registration form, when the user enter his/her birthdate, after submitting the form, the dayofbirth will appear on the the dayofbirth column on the mysql table, the same with monthofbirth, and yearofbirth. I have tried different patterns but I haven't find the best solution to make everything appear in one column that is under birth date column, I will have something like 20-11-1959. Can you help me with any suggestion please? |
Re: How To Create Birthday Table/form In Php And Mysql? by sayhi2ay(m): 1:32am On Dec 09, 2010 |
- make your DB column datetime format - then for your input field, you can merge all the 3, and use the strtotime function to convert it to a single date format. |
(1) (Reply)
Eset, Nitda Move To Secure Nigeria’s Cyber Space / Blog Design At N3,000 - Limited Offer / Where Can I Download Megamag Wordpress Theme Free?
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13 |