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
Benjamin
Site Administrator
Posts: 6935 Joined: Sun May 19, 2002 10:24 pm
Post
by Benjamin » Fri Jul 21, 2006 10:23 pm
If this is possible I would like to know how to do it..
Code: Select all
class sample
{
function __construct()
{
$this->transferPost();
}
function transferPost()
{
foreach ($_POST as $key => $value)
{
$this->$key = $value; // <--
}
}
}
So if a variable named thisName is posted, I can then access that variable with
Maybe that code I wrote up there will work but I'm assuming it's not that easy..
Christopher
Site Administrator
Posts: 13596 Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US
Post
by Christopher » Fri Jul 21, 2006 10:45 pm
Have you tried it? You could execute that very nice script faster than it takes to write a post.
Don't make me start talkin' like a pirate!
(#10850)
Benjamin
Site Administrator
Posts: 6935 Joined: Sun May 19, 2002 10:24 pm
Post
by Benjamin » Fri Jul 21, 2006 10:52 pm
Cool... Just in the middle of writing a big class and had a brainstorm.. Didn't realize it might work until after I finished writing it.
Benjamin
Site Administrator
Posts: 6935 Joined: Sun May 19, 2002 10:24 pm
Post
by Benjamin » Fri Jul 21, 2006 11:02 pm
You might want to change the channel... I think that station is off the air