FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » $_POST, $_GET and $_REQUEST discarding duplicates
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: $_POST, $_GET and $_REQUEST discarding duplicates [message #170796 is a reply to message #170793] Sat, 27 November 2010 07:17 Go to previous messageGo to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
James wrote:
^^^^^
James who?

> I am working on an application and specifically validating user
> input. The application can be sent input via POST or GET. One thing
> I need to catch is duplicate variable names being passed:

Those are not variable names, but parameter names. For variables there
needs to be a *programming* language; (X)HTML is not.

> Take the following string:
> myapp.php?a=12&a=12
>
> If I var dump $_REQUEST then or $_GET I get the following ///
>
> array(1) {
> ["verb"]=>
> string(8) "a"
> }
>
> The second instance of 'a' is dropped. If I was just using $_GET I
> would simply pull $_SERVER['QUERY_STRING] up and pass it but for POST
> data I don't believe I can do this. Can anybody suggest a function
> that will allow me to find this duplicates in in POST and GET data?

No.

<… name="verb[]" …>

will get you

array(1) {
["verb"]=>
array(…) {

}
}

It is a very old "problem", to be found discussed in a great many PHP FAQs.
Please do search next time.


PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300dec7(at)news(dot)demon(dot)co(dot)uk> (2004)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: setup of curl-multi: looping over a bunch of sites [how to adress the array]
Next Topic: ANNOUNCE: NHI1-0.10, PLMK-1.8 und libmsgque-4.8
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 19:44:27 GMT 2024

Total time taken to generate the page: 0.04078 seconds