Best method for saving online form -> MySQL for output 2 PDF

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
diseman
Forum Contributor
Posts: 174
Joined: Mon Jul 26, 2010 1:30 pm
Location: Florida

Best method for saving online form -> MySQL for output 2 PDF

Post by diseman »

Hi guys,

Never done anything like this, so wondering how you would go about doing it.

Imagine a document that has three check boxes (Yes, No, Maybe) and one of them must be marked with an 'X' when printed and handed to some fictional office.

Now online, I would prefer to code a single drop-down menu with the three options that saves the answer to my db.

However, I'm not sure how I would get the saved data to be placed, in the proper checkbox, on the outputted form when I create a PDF.

Would you save the data to one db field or would you create three separate db fields; one for each possible answer? This way, you could put the output code in each position on the form and then only one of them would appear?

Sorry for this being such an ambiguous write-up. Bottom line, would you save all three possible answers to one db field or would you create three db fields; one for YES, one for NO, and one for MAYBE?

I'll figure out how to do it later, I just want to know the best way to store the data to make it easier to get on a printed document/pdf later.

Thank you!
User avatar
Celauran
Moderator
Posts: 6425
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Best method for saving online form -> MySQL for output 2

Post by Celauran »

I'd use a single column with perhaps an ENUM for the possible values. Tinyint could also work but is a little less readable and requires translation in the code.
Post Reply