Jump to content

Inserting data into multiple tables based on user selections


user982019

Recommended Posts

Hello guys,

                I am bit stuck with my project i need your help..

 

I have a php form and sql database.

 

My user are supposed to fill up a form and it goes to db and populate its fields.

 

But, User will get an option of country "Which he can do multiple selection"

 

So in my case their are 252 countries i.e: 252 tables.

 

When user select like 3 countries such as:  3, 15, 20

 

Then the form he has filled should be populated to those 3 tables i.e: 3, 15, 20

 

And no other table should be disturbed..

 

So can anyone provide me a sample code for me how to do that.. i am stuck over here.. 

 

Please help ! Thanks in advance guys !

Your question is very vague, and this here probably scared a lot of people off:

 

 

 

So in my case their are 252 countries i.e: 252 tables.

 

Sounds like you're working from a horrible database design, so you're already behind the 8-ball.

Your question is very vague, and this here probably scared a lot of people off:

 

 

 

 

Sounds like you're working from a horrible database design, so you're already behind the 8-ball.

 

Yea i know thats why i am asking for help..   atleast just anyone can guide me up what to use or how to use it up.. :P

as to your design, you would have one table that stores the choices, one row per data item -

 

id user_id country_id

1     1       3

2     1       15

3     1       20

4     2       yy

5     2       zz

 

as to the code to take the submitted form data and insert it into a database table - php's original purpose was to process form data and there are literally 100's of thousands of examples of php form to database scripts posted all over the Internet. study some of those examples to see how others have accomplished this task.

as to your design, you would have one table that stores the choices, one row per data item -

 

id user_id country_id

1     1       3

2     1       15

3     1       20

4     2       yy

5     2       zz

 

as to the code to take the submitted form data and insert it into a database table - php's original purpose was to process form data and there are literally 100's of thousands of examples of php form to database scripts posted all over the Internet. study some of those examples to see how others have accomplished this task.

 

 

Thanks for your rough guidance.. :)  i will try to have a go on it.. 

 

if anyone can have me any tutorial regarding this its awesome !

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.