B
B
bimcom2011-10-01 21:40:50
PHP
bimcom, 2011-10-01 21:40:50

Passing PHP to POST script parameters with the same name

There was a problem:
At the input of the script, data arrives from the POST form with a request in the form:
tovarId 7285
tovarId 8689
tovarId 493
tovarId 3736
tovarId 424
tovarId 99634
tovarId 8691
tovarId 92705 tovarId
57781
unique name.
Is there a way to get all parameters of non-unique names?
PS.
You cannot edit the form.
P.P.S.
While I found a temporary solution - switch the POST method to GET in the form and get all the data through the REQUEST_URI parsing, but I would like to use POST.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
E
edogs, 2011-10-01
@bimcom

ru2.php.net/manual/en/reserved.variables.httprawpostdata.php - read the description itself and the comments to it. Quite an adequate solution, but still as a last resort. In a normal situation, it is better to pass in an array - variable[]

A
AlexeyK, 2011-10-01
@AlexeyK

“You can’t edit the form” how is it combined with “While I found a temporary solution - switch the POST method to GET in the form”?

Z
Zazza, 2011-10-01
@Zazza

the output is to make an array, i.e. betray torvaId[] but here you still have to edit a little

E
Elkaz, 2011-10-01
@Elkaz

> You can't edit the form.
> switch the POST method to GET in the form
So is it possible or still impossible?
Zazza suggested the only quick and correct solution above is to replace the tovarId name in the form with tovarId[]. Then you will receive an array with which you can work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question