blazing_bruce Posted March 25, 2006 Share Posted March 25, 2006 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 Link to comment https://forums.phpfreaks.com/topic/5792-_post-i-want-_postid-like-this/ Share on other sites More sharing options...
redarrow Posted March 25, 2006 Share Posted March 25, 2006 [!--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 Quote Link to comment https://forums.phpfreaks.com/topic/5792-_post-i-want-_postid-like-this/#findComment-20665 Share on other sites More sharing options...
ShadowOfSilence Posted March 25, 2006 Share Posted March 25, 2006 [!--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] Quote Link to comment https://forums.phpfreaks.com/topic/5792-_post-i-want-_postid-like-this/#findComment-20676 Share on other sites More sharing options...
redbullmarky Posted March 25, 2006 Share Posted March 25, 2006 [!--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] Quote Link to comment https://forums.phpfreaks.com/topic/5792-_post-i-want-_postid-like-this/#findComment-20688 Share on other sites More sharing options...
wildteen88 Posted March 26, 2006 Share Posted March 26, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/5792-_post-i-want-_postid-like-this/#findComment-20882 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.