frozenlight777 Posted January 8, 2008 Share Posted January 8, 2008 I'm fairly new to PHP and was wondering how to generate a calender from a list box when it's clicked. for example i have the following code... <form name="form1" method="post" action=""> <span> Search By: </span> <select size=1 name=list> <option value="fname">First Name</option> <option value="lname">Last Name</option> <option value="drange">Date Range</option> </select> <span class="style4">Enter Name</span> <input name="q" type="text" id="q" value="<?php echo $q; ?>"> <input type="submit" name="Submit" value="Look Up Hours"> </form> I want to make a calender or two appear when the "Date Range" item is clicked in the list box. Not quite sure how. Quote Link to comment https://forums.phpfreaks.com/topic/85031-php-listbox-help/ Share on other sites More sharing options...
The Little Guy Posted January 8, 2008 Share Posted January 8, 2008 that would use javascript example: http://www.mattkruse.com/javascript/calendarpopup/simple.html Quote Link to comment https://forums.phpfreaks.com/topic/85031-php-listbox-help/#findComment-433633 Share on other sites More sharing options...
frozenlight777 Posted January 8, 2008 Author Share Posted January 8, 2008 that's kind of what I want, however, how would I get the text box to appear when the 3rd item of the list box is clicked? Quote Link to comment https://forums.phpfreaks.com/topic/85031-php-listbox-help/#findComment-433709 Share on other sites More sharing options...
pigskins Posted January 8, 2008 Share Posted January 8, 2008 Have you looked into making an element Visible using Javascript? Google is your friend. Quote Link to comment https://forums.phpfreaks.com/topic/85031-php-listbox-help/#findComment-433806 Share on other sites More sharing options...
nikefido Posted January 8, 2008 Share Posted January 8, 2008 the javascript would be something like this: in the form, where you have the <select name="listbox" ... > add "onchange = checkListBox();" something like this: <select name="myListBox" id="myListBox" onchange = checkListBox(); > then you can have this function either on the web page or in a linked .js file: function checkListBox { if(document.getElementById("myListBox").value = "3rd item") { //make text box visible or just add text to an empty <span> or <p> using innerHTML } } you should look up the how the listbox works and how JS might interact with them, this example might not be coded totally correctly. I hope this helps, though. Quote Link to comment https://forums.phpfreaks.com/topic/85031-php-listbox-help/#findComment-433836 Share on other sites More sharing options...
Ken2k7 Posted January 8, 2008 Share Posted January 8, 2008 I don't know what you mean by calendar. If all data of the calendar is in database, you can use AJAX (which is JavaScript) + PHP Quote Link to comment https://forums.phpfreaks.com/topic/85031-php-listbox-help/#findComment-433842 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.