0

Let me just explain you my problem. I am working on a php form template which could be useful for more events in our company. In this form I collect few things about our employees but that is out of question.

My problem is that in form I have HTML SELECT element, where are some OPTIONs inside. I have this option in PHP array, for better imagination for example termins for Blood donation. I need to handle that only one employee can sign in for specific termin.

Can I somehow limit "the usage of array element"? I mean, when someone has already signed in for termin X, just don't allow another employee to pick this termin.

Thanks.

<-- EDIT -->

here is the code:

This is my config.php (the file, where all variables are configured

$termins = array(
    '8:00' => '',
    '8:30' => '',
    '9:00' => '',
    '9:30' => '',
    '10:00' => '',
    '10:30' => '',
    '11:00' => ''
);

and here is index.php where I fill the options into select element

<?php
foreach($termins as $key => $value) {
    echo '<option value="myvalue">' . $key . ' </option>';
}
?>

I think that "Disable" is the way how to solve this. When the option is already picked, i just have to change the OPTION to "Disabled". But this comes to my second question: How to change the property of html OPTION element to Disabled and keep this change? Should I use php sessions?

aynber
  • 22,380
  • 8
  • 50
  • 63

1 Answers1

0

First of all, that HTML SELECT elements are in database? If yes, doing a LEFT JOIN between form's registered users table and HTML SELECT options table you will have elements that do not match between those two tables.

Roms
  • 95
  • 8
  • no nothing is in DB. I'm using FlatDB (txt file DB). I can handle this problem in DB very easily. But I am curious about how to fix it in flatDB. I would like to keep this type of forms in FlatDB, because there is no need to spam DB with such a data. :D – Patrick Star Oct 09 '17 at 11:44