evanpyrz_jm Posted April 11, 2013 Share Posted April 11, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/276833-how-to-show-based-on-recordset-contents/ Share on other sites More sharing options...
lemmin Posted April 11, 2013 Share Posted April 11, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/276833-how-to-show-based-on-recordset-contents/#findComment-1424169 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.