dedurus
10-01-2008, 04:58 PM
Hi to all
I'm php novice,and tried to solve this problem for 3 days but no success. I've tried other php-help forums, Google, but cannot find an appropriate solution for the problem i'm stuck in.
I'm trying to make a simple script in which the user first enters the hotel info and then the room number that the hotel has.
After entering the the room number, the next step is to enter a info about each room separately (beds, floor,etc).
In this step i have manged to display enough forms that equals to the room number entered in the previous step (e.g if the hotel has 10 rooms, then the same form is displayed 10 times).
Also i have managed to increment the form fields respectively (e.g. the first form has room_name1 as a name for the field, the second has room_name2, and so on).
I want to process all values of each form as a separate record in the database, and for that to use only one submit button.
For example, if the hotel has 10 rooms, then the same form is displayed 10 times, and only one submit button for all the forms, which will process all 10 forms,each one as a separate record.
I tried several variations of the "for" loop, but i only "succeed" to insert the last form data, and not all the previous.
Does anyone have an idea how to make a "for" loop for quering (inserting) values from several forms that have dynamic form names?
Thanks in advance.
I'm php novice,and tried to solve this problem for 3 days but no success. I've tried other php-help forums, Google, but cannot find an appropriate solution for the problem i'm stuck in.
I'm trying to make a simple script in which the user first enters the hotel info and then the room number that the hotel has.
After entering the the room number, the next step is to enter a info about each room separately (beds, floor,etc).
In this step i have manged to display enough forms that equals to the room number entered in the previous step (e.g if the hotel has 10 rooms, then the same form is displayed 10 times).
Also i have managed to increment the form fields respectively (e.g. the first form has room_name1 as a name for the field, the second has room_name2, and so on).
I want to process all values of each form as a separate record in the database, and for that to use only one submit button.
For example, if the hotel has 10 rooms, then the same form is displayed 10 times, and only one submit button for all the forms, which will process all 10 forms,each one as a separate record.
I tried several variations of the "for" loop, but i only "succeed" to insert the last form data, and not all the previous.
Does anyone have an idea how to make a "for" loop for quering (inserting) values from several forms that have dynamic form names?
Thanks in advance.