hai friends Iam having three seperate combo (dropdown) box In these Iam having Month,Day,Year If i select the first combo box it shows the month (january, Febuary) If i select the second combo box it shows the day(1,2,3) if i select the third combo box it shows the year(1999,2000) This is what i have done Now i need is in the database i have dateofbirth(date (datatype)) as a single column when i select this 3 combo box it should insert in this dateofbirth column as a single value in the format of Dec 27 1984 So i need Php code for this can anybody help this Thanks in advance
$date = date('M d Y', mktime(0, 0, 0, $_POST['month'], $_POST['day'], $_POST['year'])); PHP: I would store just the timestamp though. This way it's easier to work with later, and you can sort the dates, etc...
If you want to keep the format same, you may have to change the datatype to varchar/text/blob, since "Dec 27 1984" is a string. However, try this: <? $date = $_POST['month']." ".$_POST['day']." ".$_POST['year']; ?> If you want to save data without changing the datatype, the format will be like: 1984-12-27, and you need to change the month values (Jan->1, Feb->2,...) to do this in php: <? $date = $_POST['year']."-".$_POST['month']."-".$_POST['day']; ?> Let me know if u get help from above information