72 users online (1 members and 71 guests)  


  Results 1 to 4 of 4

Related

  1. Replies: 0
  2. Replies: 1
  3. cookies and drop down menu    Forum: PHP Forum
    Replies: 4
  4. Dynamic drop downs using cookies to store    Forum: Javascript Forum
    Replies: 0
  5. JavaScript - Form Drop Down List    Forum: Javascript Forum
    Replies: 4
  1. #1
    noshankus's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2003
    Posts
    2

    Setting cookies to remember drop down list

    Hello, =)


    I have a page that the users choose their name from a drop down list, and then continue onto the rest of the site.

    How can I set it up so that cookies are set to automatically choose the name from the list (over 30 names in the list).


    I can't seem to find anything on the net about such a thing, just about typing in a pop-up screen, and then always remembering... I need the drop down box! =)


    Any and all help, is very much appreciated!
    Best regards,

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hello. Welcome to the forums.

    You dont say what language you are planning on using, so I will keep it generic.

    Set the cookie any way you like, then use whatever language you wish to detect the cookie value and write out 'selected' into the select <option> tag of the matching name.

    Post again if thats not clear (its not clear to me, and I wrote it)
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    noshankus's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2003
    Posts
    2
    Hi!

    Thanks for the quick reply!

    I'm already using HTML and Perl, but javascript is also an option! - i.e. anything I can throw in there!

    The problem is that I don't know how to code the cookie, so that it saves the choice from when the user first selects his/her name from the drop down box - I hate asking this in general, but could you supply some code (or a decent link) perhaps?

    Then the cookie gets read every time after the user returns to the page.

    I understand that it is possible, but I'm not very proficient with JavaScript, and I can't find an example that suits my needs.

    Thanks again for your time!
    Best regards,

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    I'm a bit shoddy with Perl, but JavaScript lets you code cookies very easily.

    This tutorial can explain it better than I can -

    http://www.webreference.com/js/column8/
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread