Jump to content


Photo

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


  • Please log in to reply
4 replies to this topic

#1 blazing_bruce

blazing_bruce
  • Members
  • PipPip
  • Member
  • 28 posts
  • LocationIndia

Posted 25 March 2006 - 06:45 PM

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.

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 25 March 2006 - 07:15 PM

[!--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) View Post[/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) View Post[/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


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



dont even know if this is possable but can try lol
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 ShadowOfSilence

ShadowOfSilence
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 25 March 2006 - 07:54 PM

[!--quoteo(post=358338:date=Mar 25 2006, 02:15 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Mar 25 2006, 02:15 PM) View Post[/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


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

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?
$_POST[$filName];


#4 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 25 March 2006 - 08:35 PM

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

it is

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

$a_key = 'bar';

echo $foo[$a_key];

"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#5 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 26 March 2006 - 05:20 PM

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
$_POST["$id"];
// OR
$_POST[$id];





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users