$_POST Array

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
MikeEller
Forum Newbie
Posts: 11
Joined: Sun Feb 05, 2006 3:43 pm

$_POST Array

Post 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
rnoack
Forum Commoner
Posts: 34
Joined: Mon May 03, 2010 12:38 am

Re: $_POST Array

Post 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?????????
minorDemocritus
Forum Commoner
Posts: 96
Joined: Thu Apr 01, 2010 7:28 pm
Location: Chicagoland, IL, USA

Re: $_POST Array

Post 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.
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Re: $_POST Array

Post 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
Post Reply