Forum Moderators: coopster

Message Too Old, No Replies

HELP! Inserting form-data into multiple Tables

HELP! With Inserting form-data into multiple MySQL Tables

         

rajadaniyal

10:47 pm on Apr 3, 2006 (gmt 0)

10+ Year Member



Hi,

I am trying to build a form for my website which will insert form data into 6 different tables. The problem is I'm having difficulty making it work. Would appreciate if someone could help.

Details as follows:

TABLES:
COMPLAINTS
COMPLAINANT
COMPLAINTS TYPES
COUNTRY
COUNTY
MEMBER (complaint will be made against)

My problem is I do not know how to setup the form so it will update the records in the database.

BTW here's how it should work:

Someone wants to complaint against a member. huh?
URL will have members' ID, Complainants fill in the form with their info (COMPLAINANT),
They should be able to choose COUNTRY and COUNTY from a different table which is linked in the complainant table,
then about the complaint (COMPLAINTS), where they choose
complaint category (COMPLAINTS TYPES).

I hope this makes sense and someone can help me.

Thanks in advance.

coopster

12:11 am on Apr 4, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, rajadaniyal.

I would build the <select> <option>s from the tables you specified and then display the HTML. Then after the user chooses the options, you confirm they are valid, then INSERT your complaint.

jenningsdev

7:52 pm on Apr 5, 2006 (gmt 0)

10+ Year Member



You could do several things here. What is your PHP experience like? Do you know how to use switches?

You could build a simple function that accepts $_POST['var'] and passes it to a switch that can make a decision based on the variable received and then insert the information INTO the appropriate DB table(s)

Let me know if this is helpful.

Shane

rajadaniyal

8:50 pm on Apr 5, 2006 (gmt 0)

10+ Year Member



My php knowdledge is pretty basic and I do not know switches. I would appreciate if you are able to give an example.

Cheers.

jenningsdev

9:00 pm on Apr 5, 2006 (gmt 0)

10+ Year Member



I will get something up for you to look at.

Shane

jatar_k

9:21 pm on Apr 5, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld rajadaniyal,

try this link
[php.net...]