SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Question...

Hybrid View

  1. #1
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Here is what I need to do.

    The user has multiple pages to fill out. All of the info he fills in is put into a database (MySQL). Most of the input types are check boxes. The administrator then needs to see the results of the users filling in the boxes.

    However, if certain fields are left blank they need to be turned red when the admin checks out all of the applications.

    So if a user filled in all of the check boxes except for CPR when the admin looked to see if they had CPR experience the answer would be NO, and the No would be colored red.

    Thanks,

  2. #2
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,937
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats not difficult, but one thing you have to remember is when a checkbox is not checked a nullvalue does not get sent to the server. So you have set set a default value for all your checkboxes.

    Then just do If box = nullvalue then color = red sort of thing.

    Chris

  3. #3
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Ok... But won't that take a ton of if..else.. statements? I mean I have over 400 fields

    Another question,

    On the main user screen I need to display 6 images that are links to each of the 6 forms. The links will have 2 images (one for when the form is complete and one if it is not). I know I will need to do a query to see if those fields that are in that form are filled but is there a more efficient way to do it?

  4. #4
    SitePoint Wizard
    Join Date
    Apr 2000
    Posts
    1,483
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could store all of the checkbox names in the database, then loop through them and check whether or not they are checked. There is a similar example in Kevin Yank's PHP tutorial on http://www.webmasterbase.com - check out part 6. It needs to be adapted quite a bit, but is relatively similar to your example.


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
  •