SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot Darren Lewis's Avatar
    Join Date
    Jul 2002
    Location
    UK
    Posts
    172
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Specify checkbox unticked value

    Is there a way to specify a checkbox's unticked value, or is the only option to use a yes/no radio button?
    HTML Code:
    <input type="checkbox" name="name"  value="1" />
    At present, the value of the unticked checkbox is NULL. I'd like it to be zero (I know it's a subtle difference, but I want the zero value to change a session variable, but the null value between pages should not alter the session).
    Censura - Add reviews and ratings to your site

  2. #2
    SitePoint Member
    Join Date
    Nov 2002
    Location
    Germany
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nope. Maybe
    HTML Code:
     <input type="hidden" name="name" value="0" />
     <input type="checkbox" name="name" value="1" />
    works... didn't try that, tho.

  3. #3
    SitePoint Zealot Darren Lewis's Avatar
    Join Date
    Jul 2002
    Location
    UK
    Posts
    172
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    It works!

    Yes, that does work.

    Thank you
    Censura - Add reviews and ratings to your site


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
  •