You're never going to believe what's kicking my butt this time...

    Date: 07/21/06 (PHP Community)    Keywords: php, database, java, google

    Hello, My favorite PHPers! I come to you once again with one of the easiest things I could ever imagine you've been asked, but it just...doesn't...like...me.

    And really, I should have figured this out ages ago.

    All I need to do is verify whether a checkbox has been checked.

    I've googled it, but unfortunately everything that's popped up has been for JavaScript. Which isn't used in this project.

    The status of the checkbox (either checked or unchecked) is going into a database (They're boolean fields that just get set to 0 or 1 it looks like) for use in another part of this app that I, hopefully, won't have to write (like that'll happen).

    So here's what my conditional statement looks like:

    if ($_POST['docAction1'] == checked)
      $query .= "'1', ";
    else
      $query .= "'0', ";


    Unfortunately, where it says 'checked', I don't know what is supposed to go there. I've tried many things, like "true", "on", "checked", "1", etc etc etc. But nothing gets updated in the database. So, I come to you, humbled by the simple stuff.

    Please be kind.

    p.s. The checkbox names (docAction1) will be changed at a later date to better reflect the text that will be associated with the checkbox. Right now they're just labeled as "checkbox 1, 2, 3" etc. So hush you variable-name hounds!

    Source: http://community.livejournal.com/php/473486.html

« error in PHP & MySQL in a loop || missing something stupid... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home