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