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 !

Link to comment
Share on other sites

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.

Edited by boompa
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Edited by mac_gyver
Link to comment
Share on other sites

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 !

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.