Jump to content

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


blazing_bruce

Recommended Posts

[!--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
Link to comment
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]
Link to comment
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]
Link to comment
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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.