mardi 8 novembre 2016

PHP/MySQL/Checkboxes - need suggestion

I'm trying to make a series of forms for employees to submit their hours of availability to work. I made the initial insertion form with no problem, but I'm now trying to make it editable after submission, and I'm running in to a wall.

I constructed the table so that there are A LOT of columns per row... there's 409 in total. 31 x 13 = 403 (thats 31 days in a month x 13 options per day), plus 6 for capturing of otherwise relative data.

The form is made with html and php, and it process in to a calendar that replicates in a table to match an actual calendar, and has a checkbox for each of the 13 options.

The day of the month/hours option are all in my database as day_option (i.e. 1_1, 1_2, 2_5, 5_13, etc). I've gotten in my PHP script how to count up $day and create the form with that information, but I can't figure out a good way to match the output of the row and then re-insert it as checked = checked for my checkboxes.

I know I'm a bit vague and did not provide any code, I'm really seeking advice more than code at the moment, perhaps to see if there is a good way to simplify this mess, rather than having this table with 409 columns, and mostly, how to match up my output (the month worth of data separated in to days and options) with only a daily amount of code that's being replicated. I've looked at variable variables, array searching, etc. I've sat up and plugged away for hours trying to figure out a way to make this work. But, now, I turn to you all for your advice. This is my first post, so go easy on me! Thanks.




Aucun commentaire:

Enregistrer un commentaire