www.webdeveloper.com
Results 1 to 3 of 3

Thread: Checkbox Value: check, submit, change later (DB stuff)

  1. #1
    Join Date
    Nov 2002
    Location
    NJ, USA
    Posts
    785

    Question Checkbox Value: check, submit, change later (DB stuff)

    Hi everyone!
    I have a form with large amount of checkboxes.

    1. checkboxes can be - surprise - checked and submitted into the database
    2. checkboxes values should be retrievable if I run a SELECT query on the result, meaning if I come back to this form later, my previous selection displays as selected checkbox.
    3. I want to be able to uncheck and re-check the checkboxes, to change my data.

    I thought just doing this would be sufficient: (given I already ran the query to select data from the table, and did proper open/close of results display)
    PHP Code:
    <input type="checkbox" name="230" value='<?php echo $row['230']; ?>
    I can seem to figure it out... Can anyone give me an idea?
    Thanks a bunch!

  2. #2
    Join Date
    Jan 2006
    Posts
    67
    i'm not sure what value you are storing in the database? You need something like:

    PHP Code:
    <input type="checkbox" name="230"<?php if($row['230'] == "true"){echo ' checked="checked"';} ?> />

  3. #3
    Join Date
    Nov 2002
    Location
    NJ, USA
    Posts
    785
    Thanks, I'll try that.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles