Page 1 of 1

$_POST Array

Posted: Mon May 03, 2010 8:08 am
by MikeEller
Hi Forum,

Quick question....

Is it it possible to use/send $_POST array as a parameter to function? Meaning I have a function that has as its parameter an array....the values in the array come from $_POST values from a form. Can I just pass in $_POST or do I have to read all the post values into another array?

Regards,

Mike

Re: $_POST Array

Posted: Mon May 03, 2010 8:36 am
by rnoack
I never tried that but I don't see any reason you couldn't pass a $_POST array if you could pass another array. Try it?????????

Re: $_POST Array

Posted: Mon May 03, 2010 5:07 pm
by minorDemocritus
It depends on the function. If the function accepts an array as an input, then yes. If not, then no.

Don't get used to trusting the contents of the $_POST array, thought! Keep in mind that user input is not to be trusted.

Re: $_POST Array

Posted: Mon May 03, 2010 11:05 pm
by a94060
minorDemocritus wrote:It depends on the function. If the function accepts an array as an input, then yes. If not, then no.

Don't get used to trusting the contents of the $_POST array, thought! Keep in mind that user input is not to be trusted.
Like minorDemocritus, make sure you check the input. Maybe have a function accept the input and then immediately send them to their respective purifying functions. This way you can protect your program from exploitation