Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Representing a web form in a DB / in OOP

  • 16-06-2008 2:46pm
    #1
    Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭


    Right, I've probably asked questions here before about this application that I've inherited.

    It's basically a bog-standard system of forms with a workflow behind it. Users choose a form type, answer some radio questions, fill out a few fields, then save the form and it goes forward to the next guy.

    The database is mostly normalised, with one major exception. All of the questions are represented as columns within a table.

    So you have a table storing details for form type A, and each column in that table is named, q1, q2, q3, q4, q11a, and so on.

    That would be fine. It would be smashing in fact, except that now the owner wants to change the questions - remove some, add others and so forth. Of course, the whole thing would have to be backwards compatible. That is, a form started after say 1st August would need to see the new questions and layout and if someone wanted to see a form started before 1st August, they'd be shown the old layout and questions.

    If I was starting from scratch, I could see how this could be done, and how it would be straightforward enough to make all of the forms dynamic and rendered by PHP, instead of now where each form has it's own create_form.php page, and most of the HTML is hardcoded, just with a few references to the various PHP variables. But each time I think about how to move from the current setup to a more flexible one, my head hurts and the amount of effort required seems ridiculous. Especially considering that they'll probably want it done inside of 3 weeks.

    I can also see the wrong way to do it :), but I know that going down the wrong route will only increase the volume of support/issues I'll have in future.

    My other main issue is that most of the questions are standard, but there are a few odd requirements - e.g. if q2 is yes and q5 is no, then hide section 3, but if q4 is yes and q8 is no, show section 8. Some of the questions don't have yes/no answers and others take their input from pop-ups boxes and so forth.

    Any suggestions? I know I'm grasping at straws here without anyone else having seen this application. :)
    At the moment I'm thinking of moving to an intermediate normalisation where you have a table with columns (formid, questionid, questionanswer), but where I still extract and display each question through the hardcoded HTML (order and positioning is important).

    At least doing this I can put in the if(date() > '2008-08-01') ..... style code that can display different forms based on the date.

    :(


Advertisement