Jump to content

Disable radiobutton upon database value?


biggieuk

Recommended Posts

Hi all,

Im having trouble with a certain function on my booking form.

In my database i have a 'session' table which contains  sessionid,capacity,placesbooked

On the form i have a few textboxes name,email,address etc.. and 45 radio buttons split into 4 groups. Each radio button corresponds to a sessionid.

I want the booking form to check and see if any values in 'placesbooked' are equal to the capacity and if so disable the radiobutton on the form which corresponds to the sessionid value so that it is unclickable.

Whats the best approach to this as i am stuck :(

thanks for your help.
Link to comment
https://forums.phpfreaks.com/topic/28128-disable-radiobutton-upon-database-value/
Share on other sites

Hi,

I added <?php if($placesbooked==$capacity) echo "disabled";?> to the value of each radiobutton.

This makes each radiobutton disabled and doesnt check that  '$placesbooked==$capacity'.

Do i need to assign the variables $placesbooked & $capacity to the value in the database for this to work?

[code]<?php <input name="session1" type="radio" value="T6" <? if($placesbooked==$capacity) echo "disabled";?>> ?>[/code]

thanks for your help,

Dan

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.