Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 10th, 2004, 08:22 PM
Authorized User
 
Join Date: Oct 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default coding date

     i would like to let user enter their date of birth by providing list box for them to choose the year, month and date but i don't know how. So, i end up with the following code with is very long and uneffective. And for example, February only has 28/ 29 days but the user may choose 30 and 31 with my code.
      My code below are php and i was told to build use JavaScript to dynamically add/remove days based on the month selection. But how? Please provide me with the code. Thx.

D.O.B (yy, mm, day) <?php
           echo " <select name=\"empDOByear\" tabindex=\"6\" id=\"textbox\">";
            for($i=gmdate("Y"); $i>=1900 ; $i--)
            {
                echo "<option value=\"$i\" >$i </option>";
            }
            echo " </select>";
        ?>
        <select name="empDOBmonth" tabindex="7" id="textbox2">";
            <option value="01" >01</option>
            <option value="02" >02</option>
            <option value="03" >03</option>
            <option value="04" >04</option>
            <option value="05" >05</option>
            <option value="06" >06</option>
            <option value="07" >07</option>
            <option value="08" >08</option>
            <option value="09" >09</option>
            <option value="10">10</option>
            <option value="11">11</option>
            <option value="12">12</option>
        </select>
        <?php
        echo " <select name=\"empDOBday\" tabindex=\"8\" id=\"textbox3\">";
            for($i=1; $i<=31; $i++)
            {
                echo "<option value=\"$i\" >$i </option>";
            }
            echo " </select>";
        ?><br><br>


 
Old March 11th, 2004, 04:46 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Why not use a ready made DHTML calendar control? Plenty available on the Web.

--

Joe





Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with coding Gini Visual Studio 2008 2 March 6th, 2009 04:14 PM
Coding Help sugunakar Classic ASP Professional 2 March 30th, 2008 04:42 PM
help with coding mastrgamr C++ Programming 15 November 10th, 2006 07:55 AM
Help coding here Scoob PHP How-To 3 January 26th, 2006 11:18 AM
coding mdlan PHP Databases 1 May 28th, 2005 07:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.