I need help with my “Thoughts” form…
(What once seemed like a piece of cake is turning out to be extremely complicated in my mind…)
When a User registers on my website (i.e. Creates a Member Account), I just ask for basic information like…
- username
- password
- first name
However, after their Member Account has been created, they can log back in and build a “Member Profile” which includes everything from Biographical Info, to uploading a Photo, to answering several open-ended Questions and thus publishing their “Thoughts” (on small-business).
If a Member clicks on the “change_details.php” script, it is simple, because all of the “Details” will be added to an existing record in the “member” table, so I am always doing an UPDATE.
But here comes the tricky part that I need help with…
If Member wants to deal with “Thoughts” then things are not as simple, because “Thoughts” reside in the “answer” table which is part of a many-to-many between the “member” and “question” tables.
I was going to build a “create_thoughts.php” script and then a “change_thoughts.php” script, but what is to stop a Member from trying to “change” Thoughts (records) that do not already exist, or what is to stop a Member from trying to “create” Thoughts (records) that already exist and thus creating an INSERT error?!
If a Member wants to answer Questions 1, 4, 5, and 9, then I would have to have a script intelligent enough to INSERT records for those Answers.
If a Member comes back and wants to change his/her “Thought” to Question 5, then my script has t be smart enough to do an UPDATE on that one record.
If a Member comes back and decides to answer Question 2, then my script needs to know that another INSERT is in order.
This is complicated as heck if you ask me?!
I need some help either coming up with a better workflow OR figuring out how to code this…
Thanks,
Debbie