Essentially, I’m building a prog which allows you to create a questionnaire (of sorts).
I have 2 database tables: TemplateHeaders & TemplateQuestions. This is a one to many relationship - one header, many questions.
TempHeaders just contains the template ID (Primary key), Template Name and who that template belongs to, (Company ID - Foreign Key).
TempQuestions contains the Question ID (primary key), the parent Template ID (Foreign key), and the text of the question.
TempDashboard.php lists out ALL the templates currently in development, (from the TempHeaders table). Each item in this list has a link beside it to edit that item, using a second script, TempDev.php. <-- This page lists all questions added to that template so far, from the TempQuestions table, and has a form to keep on adding to it.
So from the main page, TempDashboard.php, the link is formed like this:
// and then
This link is where the ID is coming from, first time the page is accessed. But each time a question is added, I need a way to pass the Parent Template ID back into the TempQuestions table along with it.
It’s pretty simple, but I wanted to submit the question, write to the database, read from the database and reload the same page (so it shows the newly added question), all in the same click.
Does that make sense?
(I realize that one more click per submission is not that big of a deal, but if you’re adding loads of questions then the second clicks will get old fast.)