lundi 10 août 2015

MySQL, PHP, listing a directory with some checkboxes?

Beginner here, I've been searching long and hard for a solution to my particular problem. This might be unique.

I'm working on an HTML form that is saved as a database field and used as part of a bigger application (company intranet). As I learned things, I would have set things up much differently. The form works with a functions.php file along with a couple other php and javascript files. As such, those files also perform functions for other forms as well. Just about everything on the form is a database field; it either gets checked, selected, or text entered and then submitted to the db.

There are a few tables in the db that accept data. There is one table specific to user groups, while the table gathers the data for all the other fields, including other "groups" as I would call them. One particular section of the form allows the admin to select whether or not a user gets read or write access to network drive folders. As it works now, each folder has its own db field that queries whether it is read or write (db field is enum as a checkbox).

The request is to change that section so that it lists the folders dynamically, so that when a folder is added, deleted, or changed the form automatically reflects that.

Example: (each of these fields relates to a query that determines read or write checkbox is checked)

    <td align="center" valign="middle" nowrap>#FORMFIELD_chk2001InvoicesDir#</td>
    <td align="left" valign="middle" nowrap> 2001 Invoices </td>

There are like 50 of these.

Other sections I can just edit the db and those sections reflect those changes.

Example:

    <th colspan="2" align="left" valign="middle" nowrap>#FORMFIELD_cbTeamMemberDefaults#</th>

That formfield has a enum(checkbox) field and relates to another table that has all its field values. So, when I remove one of those values, the form no longer displays that field or checkbox.

I've been looking into the easiest way to do this, and I'm wondering if best bet is to put the data into separate table and use a script to update that table, configuring that section to work like the other? I've tried to work some PHP to list out the directory with some checkboxes, but I can't get anything to do anything with the setup I have (not sure how to set up new functions or anything to work with this). My PHP-Fu is weak. Maybe I'm just missing something easy or maybe the way this application is written is just not conducive to making any real changes.




Aucun commentaire:

Enregistrer un commentaire