On Jun 11, 12:38=A0pm, Question Boy <question....@hotmail.com> wrote:
> I am trying to combine multiple php pages into 1.
>
> Basically I have created a shell page and then a seperate php file for
> each form to be included within the shell.
>
> The problem I am having is that when a user submits one of the forms
> the main shell and the other php files POST values are all returned as
> NULL and I only get the values pertaining to the form that was
> submitted?. =A0If all the files were combined into one very long php
> file, I would get all the POSTs returned how can I do the same but
> with multiple files?
>
> When you submit an include, do the POST values not get passed back to
> the Main calling page?
>
> Thank you,
>
> QB
Put a hidden input in each form with the same name and a value which
identifies the form, e.g.
<form>
<input type=3D'hidden' name=3D'whichform' value=3D'emailaddr'>
Email address <input type=3D'text' name=3D'emailaddr' value=3D'<?php print
$emailaddr; />
<input type=3D'submit' value=3D'go'>
</form>
<form>
<input type=3D'hidden' name=3D'whichform' value=3D'name'>
Name <input type=3D'text' name=3D'emailaddr' value=3D'<?php print $name; />
<input type=3D'submit' value=3D'go'>
</form>
<form>
<input type=3D'hidden' name=3D'whichform' value=3D'telno'>
<input type=3D'text' name=3D'emailaddr' value=3D'<?php print $telno; />
<input type=3D'submit' value=3D'go'>
</form>
.....
Then in the page which process the response.....
switch($_REQUEST['whichform']) {
case 'emailaddr':
case 'name':
case 'telno':
${$_REQUEST['whichform']}=3D${$_REQUEST[$_REQUEST['whichform']]};
break;
}
(obviously you'd want to change this a bit to accomodate multiple
fields in a form).
Alternatively, don't put <form>...</form> tags in the individual
forms, but rather enclose all the files in the tags at the shell
script level.
Alternatively, ignore the NULL responses (by checking arry_key_exists
($_REQUEST, $name_unique_to_this_form))
Not hard.
C.