How to use check boxes dynamically and store the choice in a database.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cwhite830
    New Member
    • Aug 2010
    • 2

    How to use check boxes dynamically and store the choice in a database.

    I am creating a picnic sign-up page where the user enters:
    1 - their first and last name in a text field
    2 - checks a box if they are a member or visitor
    3 - enters in a text field the number of people attending in their party
    4 - and a list of items to choose from, that have already been determined and entered into a database. Beside these items is a check box for them to choose what item they would like to bring.

    Once the user enters their information and chooses their item, I would like it to be stored in a database. This part I can probably figure out, but what I am needing help on is this making an item disappear from the page once someone has chosen that item until all items have been chosen. This way there are not duplicates. However, we may need about five people bringing baked beans and I want the baked beans to stay visible until five people have chosen that specific item. Does this make sense?

    As you can tell, I am new to PHP, but I am an eager learning and would love to make this work. I would appreciate any advice I could get or suggestions that would make more sense on how to code this type of project. My server does not support ASP.net, so that is why I am moving towards PHP.

    Thank you so much for your help.
    Cindy
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    To solve the specific problem you can follow a simple technique.
    Add two more column in the table that is holding the item information which would be brought by member/visitor.
    Say one column name is maximum_item other column name is available_item

    In the maximum_item column store how many people can bring this specific item. And use available_item for counting. And in the query you will define the criteria.

    you can do this by avoiding maximum_item. just from storing maximum value to available_item. Every time user choose a item that would subtract 1. When it reach zero query wont choose it for list. But this is not a smart idea. Cause you will loose the amount you choose to bring by the guests.

    Comment

    • cwhite830
      New Member
      • Aug 2010
      • 2

      #3
      Johny, thank you! I thought about creating this in flash as well because I can make it work with disappearing, but not sure about pulling a query. Another problem would be if someone has an old system and cannot download flash player. This creation is for a website that retired woodworkers use for information and most may have old PCs. Check it out, but the page I am creating is not on their website. www.richmondwoodturners.org

      If I have time between classes I plan on creating a similar type page for their Library information. I just started helping them by recreating their website and making it as simple as possible for them to understand and use. Some are not web users. :)

      Thank you again,
      Cindy

      Comment

      • Avadhesh666
        Banned
        New Member
        • Jul 2010
        • 2

        #4
        Johny thanks it is going to help many people.

        Comment

        • johny10151981
          Top Contributor
          • Jan 2010
          • 1059

          #5
          You are welcome
          :) I love to help :)

          If you face anymore trouble. Lots of people visit this site just to help :)

          Comment

          • johny10151981
            Top Contributor
            • Jan 2010
            • 1059

            #6
            If you can provide the link of your work we can take a look and suggest :)

            Comment

            Working...