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
pedroz
Forum Commoner
Posts: 99 Joined: Thu Nov 03, 2005 6:21 am
Post
by pedroz » Wed Mar 22, 2006 3:18 am
Code: Select all
$_GET['action']=$includeaction;
$_GET['forum']=$includeforum;
$_GET['topic']=$includetopic;
........ more
I have several $_GET's that I would like to put in array.
What is wrong with the code above?
Seems to be this...
$include$includevar[$i]
Code: Select all
$includevar=array('action','forum','topic',....... more);
for ($i=0; $i<count($includevar); $i++) $_GET[''.$includevar[$i].'']=$include$includevar[$i];
pedroz
Forum Commoner
Posts: 99 Joined: Thu Nov 03, 2005 6:21 am
Post
by pedroz » Wed Mar 22, 2006 3:48 am
In other words what I need is
$a='world';
$hello$a='ok';
echo $helloworld;
// ok
patrikG
DevNet Master
Posts: 4235 Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK
Post
by patrikG » Wed Mar 22, 2006 4:02 am
not quite clear what you're trying to achieve. It appears as if you want to concatenate strings.
If that is so, use . between string variables to do that.
Code: Select all
for ($i=0; $i<count($includevar); $i++) {
$_GET[$includevar[$i]]=$include.$includevar[$i];
}
umang
Forum Newbie
Posts: 1 Joined: Mon Mar 13, 2006 1:11 am
Location: MUmbai
Contact:
Post
by umang » Wed Mar 22, 2006 5:04 am
hi,
you need only
function to call and you get array of that
and wan a use them
use like:
Code: Select all
foreach ( $_GET as $key => $val)
{
echo $key;
echo "<br>";
echo $val;
}
patrikG
DevNet Master
Posts: 4235 Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK
Post
by patrikG » Wed Mar 22, 2006 5:06 am
umang wrote: hi,
you need only
function to call and you get array of that
and wan a use them
use like:
Code: Select all
foreach ( $_GET as $key => $val)
{
echo $key;
echo "<br>";
echo $val;
}
That's a security risk and opens the door for sql- and code-injection.