tags:

views:

17

answers:

1

I want to post something to my database which consists of two tables which are linked with a foreign key. I want to be able to post something to the first table which has only two cells (city and city_id) via php and then get redirected to the second table where someone can post detail about places of the city (houses squares ect (city_id is the foreign key here)) whith an one-to-many relationship. How can I do that? Should I write two php files and how can I connect the two tables?

+1  A: 

You can insert the city records, use mysql_insert_id() after the insert to get the cityid for the inserted record, and then redirect to a details posting page with e.g. a URL parameter for the cityid.

Will A
OMG Ponies