![]() |
$_POST to function
Can I pass everything in $_POST[] into a function? How would I go about that, just function($_POST) or something else? or should it just pass anyways because $_POST is a superglobal
|
$_POST is an a global array. You can call any variable in POST by using $_POST['variable'] . You don't need to pass the actual array to a function because all functions should be able to access it.
|
that's what I wasn't sure of, thank you.
|
I'm not sure you know this already, but you can also access global variables from a function without passing them as an argument:
:
$someGlobalVariable = "A value for a random, global variable"; |
If the function is quite general, and can accept any array, passing $_POST to it should be fine. If it's been created specifically to deal with the $_POST array, as others have said, you can access it from directly within the function.
|
need help with content management system
|
Good ta know. Have fun finding it.
|
@ cool and fit: what's fit, your body? Your approach isn't, it sucks. Read the forum's rules/FAQ. Read the "How to Post a Question" thread at the top of the C forum. You're a new member -- check out the community before you decide it operates like your little brother's blog. The rules/FAQ also have a link to a "How to ask questions the smart way" document. That's a good one to read, too. Last, but not least, don't hijack another person's thread; particularly if your subject isn't even the same.
|
| All times are GMT -5. The time now is 6:55 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC