SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Evangelist
    Join Date
    Feb 2005
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help getting value out of check box and input box for same field

    Hi guys. Have a form for a removal site. What I need is the user to select an item in an check box if they have ie sofa and then to enter how many sofas in an input box. I need to do this with numerous items and then have the results emailed to me. Any ideas how to do this please. Or any tutorials around thanks

  2. #2
    SitePoint Evangelist smftre's Avatar
    Join Date
    Dec 2008
    Location
    London
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The question is, "do you know javascript?"
    Statvoo.com The Website Traffic Monitor
    The best way to monitor traffic to your sites for free!


    Web Development London UK We make web 3.0 applications

  3. #3
    SitePoint Evangelist
    Join Date
    Feb 2005
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not brilliant at it but think I can get around it. Would it be better doing it in Javascript? Only the rest of my form I have developed it in php

  4. #4
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Eh? What's so complicated about it?

    HTML Code:
    <label for="sofas">Sofas</label><input type="checkbox" name="sofas" id="sofas" />
    <label for="sofas_qty">Quantity</label><input type="text" name="sofas_qty" id="sofas_qty" />
    In terms of UX it's crap, though.

  5. #5
    SitePoint Evangelist smftre's Avatar
    Join Date
    Dec 2008
    Location
    London
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, you draw the form in php but you dont want to keep reloading the page as the user fills out the form!
    So I would pull in content via javascript or show/hide fields according to what the user selects, then send the form at the end with php.
    Statvoo.com The Website Traffic Monitor
    The best way to monitor traffic to your sites for free!


    Web Development London UK We make web 3.0 applications

  6. #6
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could just test whether or not the input had a value. If it doesn't, assume "unchecked", else "checked"

  7. #7
    SitePoint Evangelist
    Join Date
    Feb 2005
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers guys. I have managed to get it done in Javascript, works a treat.

  8. #8
    SitePoint Evangelist smftre's Avatar
    Join Date
    Dec 2008
    Location
    London
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    np
    Statvoo.com The Website Traffic Monitor
    The best way to monitor traffic to your sites for free!


    Web Development London UK We make web 3.0 applications


Tags for this Thread

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
  •