Maintaining relation between variable while POSTING/FETCHING

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rpnew
Forum Newbie
Posts: 2
Joined: Tue Sep 04, 2007 12:20 am

Maintaining relation between variable while POSTING/FETCHING

Post by rpnew »

Hello friends....
I'm developing one project in PHP-MySql on FC4.....
I'm facing a problem here at one place. Let me describe it....

I've one page in php on which i'm generating a table containing checkboxes for option. These options have suboptions. User need to chose these options and suboptions. with suboption they are getting textboxes in which they can enter values for suboptons. When they submit the form i need to get all these data and accordingly store them into the database.
Now problem comes because all these checkboxes and textboxes are generated dynamically meaning through values in database. So i've made an arrays for all these so that i can get the values of selected checkboxes and textboxes. So the problem is on the second page i cant determine which suboption and textbox value goes to which option means relation is broken i need to maintain this relation so that i can store these values in database maintaining foreign key..

Now let me describe my database a bit so that if you have any other option then this you can suggest me.

In database i've four tables say table1,table2,table3 and table4.

Table1 contains name of OPTION and NUMBER of SUBOPTION it has.
Table2 contains name of SUBOPTIONS and OPTIONS they belongs(foreign key)

Table3 is similar to Table1 and Table4 is similar to Table2(with one field added which will store the value of SUBOPTION coming through TEXTBOXES which user is providing at runtime.)

So what i'm doing is getting the OPTIONS and SUBOPTIONS values from Table1 and 2 respectively and generating form. So when user submits the form i want to store these values into Table3 and 4 respectively.

I told you what i'm doing. so if you can help with that its good and if you have any other idea with GUI as well let me know.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Maintaining relation between variable while POSTING/FETC

Post by Christopher »

[quote="rpnew"So the problem is on the second page i cant determine which suboption and textbox value goes to which option means relation is broken i need to maintain this relation so that i can store these values in database maintaining foreign key..[/quote]
If you are not, you should generate the HTML form on the first page from the data in the database. Then the second base can know what is being sent because you created it.
(#10850)
rpnew
Forum Newbie
Posts: 2
Joined: Tue Sep 04, 2007 12:20 am

Post by rpnew »

well yeah i'm generating the HTML form but the problem is everything is generated dynamically so all have the same name... so in short its an array.. so how to determine which suboption belongs to which option as every option has same name array and every suboption has same(different then option array) array...... another thing is i dont know how many optins a user is going to select and each options has different no of suboptions... so how to determine these things on second page.....

If you have any other idea.. let me know.. if you want to know waht exactly i want read my earlier post or ask me...

Regards,
RP
Post Reply