A
Anonymous
Guest
Hey people,
I have one form that collects user details like name and email address, and one that collects the user's preferences from a list of checkboxes.
When they submit the first form, that data is entered into one table, and the next form is displayed. The checkbox data is stored in another table.
I am having trouble linking the two. There is a userID column in the first table, and I have set that as the Primary Key. There is a UserID column in the second table too, and I have set that up as a Foreign Key that references userID in the first table.
However, when a user fills in both forms, the userID in the first table auto increments, but the userID in the second table just defaults to '0'. I presume this is simply a mySql problem as opposed to a PHP one.
Any help is greatly appreciated. Thanks :help:
I have one form that collects user details like name and email address, and one that collects the user's preferences from a list of checkboxes.
When they submit the first form, that data is entered into one table, and the next form is displayed. The checkbox data is stored in another table.
I am having trouble linking the two. There is a userID column in the first table, and I have set that as the Primary Key. There is a UserID column in the second table too, and I have set that up as a Foreign Key that references userID in the first table.
However, when a user fills in both forms, the userID in the first table auto increments, but the userID in the second table just defaults to '0'. I presume this is simply a mySql problem as opposed to a PHP one.
Any help is greatly appreciated. Thanks :help: