Jump to content

Archived

This topic is now archived and is closed to further replies.

blazing_bruce

$_POST[]; i want $_POST[$id]; like this

Recommended Posts

hello,
now we are using $_POST['id']; like this .
i want to use $_POST['$id']; help me.

i want to place a php variable inside of $_POST[] please help me.

Thank you,
Karthi keyan.

Share this post


Link to post
Share on other sites
[!--quoteo(post=358328:date=Mar 25 2006, 06:45 PM:name=blazing_bruce)--][div class=\'quotetop\']QUOTE(blazing_bruce @ Mar 25 2006, 06:45 PM) [snapback]358328[/snapback][/div][div class=\'quotemain\'][!--quotec--]
hello,
now we are using $_POST['id']; like this .
i want to use $_POST['$id']; help me.

i want to place a php variable inside of $_POST[] please help me.

Thank you,
Karthi keyan.
[/quote]

I tried with sessions varables and even a class sorry.



[!--quoteo(post=358338:date=Mar 25 2006, 07:06 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Mar 25 2006, 07:06 PM) [snapback]358338[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I tried with sessions varables and even a class sorry.
[/quote]


this is a long shot but not tested theo can try theo

[code]

$_POST['id'] = '$id';

[/code]


dont even know if this is possable but can try lol

Share this post


Link to post
Share on other sites
[!--quoteo(post=358338:date=Mar 25 2006, 02:15 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Mar 25 2006, 02:15 PM) [snapback]358338[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I tried with sessions varables and even a class sorry.
this is a long shot but not tested theo can try theo

[code]

$_POST['id'] = '$id';

[/code]
dont even know if this is possable but can try lol
[/quote]


I would have thought it would be like placing any other variable into it?
[code]$_POST[$filName];[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=358351:date=Mar 25 2006, 07:54 PM:name=ShadowOfSilence)--][div class=\'quotetop\']QUOTE(ShadowOfSilence @ Mar 25 2006, 07:54 PM) [snapback]358351[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I would have thought it would be like placing any other variable into it?
[code]$_POST[$filName];[/code]
[/quote]

it is

[code]
$foo['bar'] = 'test';

$a_key = 'bar';

echo $foo[$a_key];
[/code]

Share this post


Link to post
Share on other sites
Rather than using the single quotes for the index/key you use double quotes, that way PHP will use the value stored in the id variable as the index/key. As currently PHP was treating your variable 'as-is' and so was tring to find a index/key called $id in the _POST array.

So eother of the following will work
[code]$_POST["$id"];
// OR
$_POST[$id];[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.