Reply to Re: getting data for duplicate keys in $_POST

Your name:

Reply:


Posted by Jerry Stuckle on 06/13/06 01:51

Egbert Teeselink wrote:
> Hi there,
>
> I'm trying to process a form that I got from a JSP generated page.
> Basically, want to take out and process some of the data, and redirect the
> rest to a JSP page that will handle the rest. All works well, i traverse
> $_POST, writeout hidden input fields and autosubmit the form with a little
> javascript, a perfectly acceptable solution for our users.
>
> However, the data the JSP page sends contains one certain input with the
> same name a couple of times. Due to complicated reasons, I cannot change
> that name into a PHP-style array. PHP, however, throws all the values of
> those fields away except for the last one.
>
> Is there any way to retreive data from inputs with duplicate names? I know
> that with GET, I could just parse the query string myself, but sadly i need
> to use $_POST (the thing I'm processing in PHP is a file upload). I have no
> way of changing the input names themselves (and see no alternative other
> than pulling a lot of ugly javascript hacks in the JSP page to fake it all).
>
> Thanks in advance,
>
> Egbert
>
>

Write those out as

name="optionname[]"


The [] causes the values to be stored in the array, i.e.

$_POST['optionname'][0]
$_POST['optionname'][1]
$_POST['optionname'][0]
...
etc.

If you can't change the html being written, then I agree with ambush - you'll
have to check the raw data.




--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация