The size of the php file is not realy a problem as it is the server that needs to handle it and not the client or bandwidth.
If you mean the html returned to the client is 120k then you are right to be concerned. I recently had a similar problem.
The way I tackled it was:
- Look at the generated html and look for ways to change the source file to reduce its size. for example:
a. remove all white space (this can be a lot if you use pretty formatted html - but it is not necessary at the client end.
b. If you use styles (CSS) make the style names very short - even 1 character. If your html is littered with them they will take up space.
c. try moving class statements to the highest significant block. e.g. in tables set the most common class at row, even table level. and then ONLY specify a class for a block if it is not the default.
d. If you are not using css styles at all and have a table with lots of formatting in it move to styles. It can make a huge difference.
Now if the file is still too long you will need to break it up for the client. There are basically two ways to do this. The simplest is to break up the form into separate pages each with its own php, etc but linked through the action of the form.
A more elequent way is to break up the form into separate functions in the same php source and use a switch to decide which to show next to the client. The action on the form always pointing to the same source file but your submit button taking a value of the next page. This is commonly shown in the PHP books and looks neat.
To give you some idea the switch could look something like this:
switch ($submit_value){
case "personal":
if (!validate_personal){
show_headers();
show_contact_form();
show_footers();
} else {
show_headers();
show_errors();
show_personal_form();
show_footers();
case "contact":
. . .
case "career":
. . .
case "thankyou":
. . .
default:
echo "oops! programmer goofed - no such form";
}
If you are breaking up your code in this way take the time to modularise it as much as possible into functions so once you have all the little bits working you can concentrate on the logic.
Cheers,
Cris