timmah1 Posted June 4, 2008 Share Posted June 4, 2008 How would I take 3 drop-down menus and combine into one for insertion into mysql? Example: Birthday drop-downs <select name="day" id="day"> <option value="1">1</option> </select> <select name="year" id="year"> <option value="2008">2008</option> </select> <select name="month" id="month'> <option value="01">January</option> </select> My field in the database is dob set as DATE I want to make this three drop-downs in the date format, and I cannot figure out how. Can someone show me? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/108755-solved-mergins-post-into-one/ Share on other sites More sharing options...
whizard Posted June 4, 2008 Share Posted June 4, 2008 $date = $_POST['day']."-".$_POST['month']."-".$_POST['year']; although you prob want to cleanse the data first to avoid injection.. Dan Link to comment https://forums.phpfreaks.com/topic/108755-solved-mergins-post-into-one/#findComment-557813 Share on other sites More sharing options...
rhodesa Posted June 4, 2008 Share Posted June 4, 2008 I think MySQL prefers YYYY-MM-DD format: $date = $_POST['year']."-".$_POST['month']."-".$_POST['day']; Link to comment https://forums.phpfreaks.com/topic/108755-solved-mergins-post-into-one/#findComment-557814 Share on other sites More sharing options...
whizard Posted June 4, 2008 Share Posted June 4, 2008 yeah my bad dont know why i didnt think of that Link to comment https://forums.phpfreaks.com/topic/108755-solved-mergins-post-into-one/#findComment-557817 Share on other sites More sharing options...
timmah1 Posted June 4, 2008 Author Share Posted June 4, 2008 perfect! Thanks rhodesa Link to comment https://forums.phpfreaks.com/topic/108755-solved-mergins-post-into-one/#findComment-557819 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.