I'm fairly new to PHP and I'm currently working on an application that has a series of large forms which allow a user to input personal details.
Basically they input details on screen1, hit the submit button, the data gets updated on a MySQL database and then they move to screen2, input further details and that in turn gets added to the database etc....
I read in Dubois' MySQL book that it is good practice to put the code for updating the database in the same PHP file that displays the form.
I've coded this in that way so the ACTION for the form is to call $PHP_SELF. I have got this working fine.
The question is how do I pass control from screen1 to screen2 after screen1 has in effect been called a second time and updated the database ? What I want is some way to achieve what is in effect a goto (heaven forbid). If possible, I believe that this would achieve the neatest solution
My current solution was is to 'require' the next php file as a .inc, but I've hit problems when screen2 trys to 'require' a common include file which screen1 has already 'required'. This causes an error.
Less attractive alternatives are to put all of the forms into one big PHP file or to break each screen into two php files (one to accept the input and one to update the database and display the next screen).
Maybe (and hopefully) I'm having a mental block and the solution is incredibly simple.
Can anyone shed any light on this please ?