Skip to main content
Inspiring
September 22, 2006
Question

Disable checkbox only if data is present

  • September 22, 2006
  • 1 reply
  • 310 views
Ok this is my problem. I create a leave request page, the employees log in. After they log in it takes them to a calandar. On the calandar they request the leave by clicking a check mark box next to the day they are requesting and hit submit. And the record is updated. To prevent duplicate entrys in our database, if the employee wants to request additional leave for that month they login and return to the calandar. The calandar already displays the days that they have prevously requested. Now this is my problem. It displays the days they prevously requested as planed, but I want to block the user from changing any of the exising checkmarks from a prevous request. Is it possible to Gray these out or hide these fields with checkmarks. Thanks for you help in advance.
This topic has been closed for replies.

1 reply

September 22, 2006
if they have allready requested a day print disabled='disabled' in the checkbox.
what i would do is write a function like:
function is_day_selected($date){
//check the database
//if the date is requested then return true
//else return false
}
then in your checkbox
<?php if(is_day_selected($date){echo "disabled='disabled'"; ?>
lands1ideAuthor
Inspiring
September 22, 2006
How would i have it write disabled if the box is check? Do I go into atributes or do I have to write a function.