SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Jan 2006
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy displaying todays date in dropdown menu

    hello All

    i was wandering id you could help me

    i have this drop down menu

    &nbsp;<select name="cdate" id="cdate" onchange="changedate()">
    <option>Date</option>
    <option value="n">No date</option>
    <option value="a">2nd April 2006</option>
    <option value="b">2 April 2006</option>
    <option value="c">2nd Apr 2006</option>
    <option value="d">2 Apr 2006</option>
    <option value="e">02/04/2006</option>
    <option value="f">2nd April 06</option>
    <option value="g">2 April 06</option>
    <option value="h">2nd Apr 06</option>
    <option value="i">2 Apr 06</option>
    <option value="j">02/04/06</option>
    <option value="k">2nd April</option>
    <option value="l">2 April</option>
    <option value="m">2nd Apr</option>
    <option value="o">2 Apr</option>
    <option value="p">02/04</option>
    </select>

    can i make it change the date dynamic, so when its todys date it will show it in the drop down list in the above format.

    at the moment if you click on the options above it will show the date on the format for example 2nd Apr 2006 it will show 4th april 2006, so it works but it displays the 2nd instead as i started the application on than.

    any ideas

    thanks

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so basically you want to add selected="selected" to the <option> element which corresponds to the users selected, or which corresponds to todays date?


    curious, why are you using 3 different formats for the date?

  3. #3
    SitePoint Addict CommanderZ's Avatar
    Join Date
    Apr 2006
    Location
    Czech Republic
    Posts
    236
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its task for JavaSript, not for PHP (if you're going to change the date without reloading the page)

    If you can reload the page, just put PHP variables here.

  4. #4
    SitePoint Addict
    Join Date
    Jan 2006
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by clamcrusher
    so basically you want to add selected="selected" to the <option> element which corresponds to the users selected, or which corresponds to todays date?


    curious, why are you using 3 different formats for the date?

    ya thats basicaly it, i,m using as many as i can, i have the whole function for the dates in javascript, if its possible for javascript thats fine? any ideas

  5. #5
    SitePoint Addict
    Join Date
    Jan 2006
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by CommanderZ
    Its task for JavaSript, not for PHP (if you're going to change the date without reloading the page)

    If you can reload the page, just put PHP variables here.
    yeb i wanna change the date with out reloading the page, as soon as you press your choice it will display in the textbox.

    i think javascript is probably the solution can you guide me on how?

    thanks

  6. #6
    SitePoint Addict CommanderZ's Avatar
    Join Date
    Apr 2006
    Location
    Czech Republic
    Posts
    236
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  7. #7
    SitePoint Addict
    Join Date
    Jan 2006
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks well have alook

    any other ideas would be great


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •