Jump to content

How to "Show" Based on Recordset Contents


evanpyrz_jm

Recommended Posts

Hi all,

           Okay, I'll try to explain briefly but thoroughly on what I'm trying to do. FYI I have a general working knowledge of PHP & mySQL, and use Dreamweaver and it's built-in tools regularly.

 

I have a registeration form, which gives the option to register into 4 age groups (via a radio button), which just submits as text into the database. What I am looking to be able to do is "Show If" (I think?) a disabled="true" to disable a radio button, once a certain amount of records have been submitted for a specific group. So I'm assumming the way to do this is to call up the full list from the database (not very many entries) and check if the limit of 15 per age group is reached?

 

            Let me know if that makes sense, any if you can give me any guidance. It will be much appreciated! Also, if you have the time to explain your coding to me too, so I can learn from it, that would be great!

 

--EVP

Link to comment
Share on other sites

Yes, you would want to check the data already stored to see the current status. The other method would be to set a flag once 15 entries are entered, but that would assume the data never changes. To do the former:

SELECT COUNT(*), age_group FROM registrants GROUP BY age_group

This query will return rows with the age_group and the total number of rows in that age_group. You can use the result to check for a maximum number and output a disabled="disabled" to your input in such a case.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.