On Fri, 2001-11-16 at 10:19, Matthew Luchak wrote: > > If you know the setup of the form beforehand it is relatively easy to do > something like : > > $string="$myfield1[0] $myfield2[0] $myfield1[1] $myfield2[1] etc..." > > However I remember one of my stupid mistakes awhile ago was mistakenly > giving two form fields the same name. My result was that the second > field overwrote the first. How do you get an array?
By putting brackets after the variable name [] in a form element <input type="text" name="text[]"> <input type="text" name="text[]"> <input type="text" name="text[]"> // etc this will emerge as $text[0]..[2]: being each value in the form > > > > ____________________________ > Matthew Luchak > Webmaster > Kaydara Inc. > [EMAIL PROTECTED] > > > -----Original Message----- > From: Stefan [mailto:[EMAIL PROTECTED]] > Sent: Friday, November 16, 2001 10:03 AM > To: PHP > Subject: [PHP] Parse POST-Data myself > > > Hi > > I have following problem: > I get a form with some fields having the same name. > PHP solves this problem by appending [] to the form-field-names which > causes the creation of arrays. > My problem now is, that I have to pass those variables further to > another script (not PHP) in exactly that order I receive them from the > form. > But when I have a form (schematically) like this: > -input type=text name=myfield1 > -input type=text name=myfield2 > -input type=text name=myfield1 > -input type=text name=myfield2 > -input type=text name=myfield1 > -input type=text name=myfield2 > > Then I get in PHP all myfield1 in 1 variable (the array myfield1) and > all myfield2 in 1 other variable -> order is irreversibly destroyed. > Give the fields numbers is not a solution (for complexity reasons). > > So my ultima ratio is to parse the post-data myself - but how can I do > this? > I have not found any indices for a variable containing post-data :-( > > If someone has another approach to a solution: I will have both ears > open for it :) > > Thanks in advance > Stefan Rusterholz, [EMAIL PROTECTED] > ---------------------------------- > interaktion gmbh > Stefan Rusterholz > Zürichbergstrasse 17 > 8032 Zürich > ---------------------------------- > T. +41 1 253 19 55 > F. +41 1 253 19 56 > W3 www.interaktion.ch > ---------------------------------- > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]