chriscloyd Posted December 29, 2006 Share Posted December 29, 2006 i have a form in php where people do there bdays so say like they choose february i want it to make it drop down the box with only 28 characters can any one help me with this part im not a noob at php i just dont know how to do this Link to comment https://forums.phpfreaks.com/topic/32153-dynamic/ Share on other sites More sharing options...
emehrkay Posted December 29, 2006 Share Posted December 29, 2006 try this function. add to your select field onchange = "updateDropDown();" and put that select box in its own field or div or something with an unique id.let me know if it works or not[code]function updateDropDown(){ var days = new Object(); days['Jan'] = 30; days['Feb'] = 28; var month = document.getElementById('month field').value; for(keyVar in days){ if(keyVar == month){ dayCount = days[keyVar]; continue; } } list = '<select >'; for(var i = 0; i < dayCount.length; i++){ day = i + 1; list += '<option value="'+ day +'">'+ day +'</option>'; } list += '</select>'; document.getElementById('idof field that holds your drop down').innerHTML = list;}[/code] Link to comment https://forums.phpfreaks.com/topic/32153-dynamic/#findComment-149458 Share on other sites More sharing options...
fenway Posted December 30, 2006 Share Posted December 30, 2006 Why doesn't every use proper date widgets? Link to comment https://forums.phpfreaks.com/topic/32153-dynamic/#findComment-150014 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.