Passing a multiple select array through several forms
Posted: Tue Apr 20, 2004 6:19 am
Hello array experts,
Tuff question I guess. At the moment I'm experiencing problems with passing a multiple select single dimensional array through several forms.
This means, I do have a form in which I create the array. As follows (of course simplified):
// Script1----------------------------------------------------------
ECHO "<TABLE>";
ECHO "<FORM NAME=\"customerForm1\" METHOD='POST' ACTION=\"chooseForm.php?title=$title\">\n";
// ....
ECHO "<TR>";
ECHO "<TD><SELECT NAME='title[]' MULTIPLE>\n";
fillArray("Prof",$title);
fillArray("Master",$title);
fillArray("Engineer",$title);
// etc.
ECHO "</TD>";
ECHO "</TR>";
// ....
ECHO "</FORM>";
ECHO "</TABLE>";
// ---------------------------------------------------------------
So far no problem. The array gets filled as it should be done, and arrives perfectly at chooseForm.php. In chooseForm I do call another function in another php script, which contains another form. This looks like this:
// Script2--------------------------------------------------------
function createSecondForm($title) {
ECHO "<TABLE>";
ECHO "<FORM NAME=\"customerForm2\" METHOD='POST' ACTION=\"postForm.php?title=$title\">\n";
// .....
ECHO "</FORM>";
ECHO "</TABLE>";
}
// ---------------------------------------------------------------
The title-array even arrives perfectly at script2. But, the problems are there as soon as I'm trying to post customerForm2. The contents of the array are gone, and instead becomes $title an empty array except for the text "array" at position 0 of this array.
I really don't understand, how it is possible that posting the array from customerForm1 is no problem, but is not working when posting from customerForm2. I even tried to use <INPUT TYPE=\"hidden\" NAME='title[]' VALUE='$title'> in customerForm2, but that didn't have any effect.
I would appreciate any help.
Kind regards,
Antonie
Tuff question I guess. At the moment I'm experiencing problems with passing a multiple select single dimensional array through several forms.
This means, I do have a form in which I create the array. As follows (of course simplified):
// Script1----------------------------------------------------------
ECHO "<TABLE>";
ECHO "<FORM NAME=\"customerForm1\" METHOD='POST' ACTION=\"chooseForm.php?title=$title\">\n";
// ....
ECHO "<TR>";
ECHO "<TD><SELECT NAME='title[]' MULTIPLE>\n";
fillArray("Prof",$title);
fillArray("Master",$title);
fillArray("Engineer",$title);
// etc.
ECHO "</TD>";
ECHO "</TR>";
// ....
ECHO "</FORM>";
ECHO "</TABLE>";
// ---------------------------------------------------------------
So far no problem. The array gets filled as it should be done, and arrives perfectly at chooseForm.php. In chooseForm I do call another function in another php script, which contains another form. This looks like this:
// Script2--------------------------------------------------------
function createSecondForm($title) {
ECHO "<TABLE>";
ECHO "<FORM NAME=\"customerForm2\" METHOD='POST' ACTION=\"postForm.php?title=$title\">\n";
// .....
ECHO "</FORM>";
ECHO "</TABLE>";
}
// ---------------------------------------------------------------
The title-array even arrives perfectly at script2. But, the problems are there as soon as I'm trying to post customerForm2. The contents of the array are gone, and instead becomes $title an empty array except for the text "array" at position 0 of this array.
I really don't understand, how it is possible that posting the array from customerForm1 is no problem, but is not working when posting from customerForm2. I even tried to use <INPUT TYPE=\"hidden\" NAME='title[]' VALUE='$title'> in customerForm2, but that didn't have any effect.
I would appreciate any help.
Kind regards,
Antonie