Page 2 of 2

Posted: Tue Jan 13, 2004 10:02 pm
by d3ad1ysp0rk
ya I've found $_POST['something'] not to work, so i convert it to a variable first.

Code: Select all

$name = $_POST['name'];
echo <<<EOT
hey $name! You have no friends! bwahahaha.. im tired!
EOT;

Posted: Tue Jan 13, 2004 11:47 pm
by Nay
You should have asked me instead ;). I'd turn you into a heredoc freak, free of charge :).

-Nay

Posted: Wed Jan 14, 2004 4:15 am
by twigletmac
LiLpunkSkateR wrote:ya I've found $_POST['something'] not to work, so i convert it to a variable first.

Code: Select all

$name = $_POST['name'];
echo <<<EOT
hey $name! You have no friends! bwahahaha.. im tired!
EOT;
As Nay said, put it into curly quotes:

Code: Select all

echo <<<EOT
hey {$_POST['name']}! You have no friends! bwahahaha.. im tired!
EOT;
Mac

Posted: Wed Jan 14, 2004 11:10 am
by dull1554
I'm sorry but you guys actually compleatly missed my question, i guess i need to clear it up a bit,

what i'm doing is i made a loop for a menu, the url's and the link text ar captures from the post function, but on the previous page the url's and the link text are named LU_1, LU_2, LU_3, and LT_1, LT_2, LT_3, and what i'm doing but failing at doing is this

Code: Select all

$n1 = "0";
$the_num_num = "1";

while($_GET['number_of_links']>$n1)
{
Print <<< EOT
<a href={$_POST['LU_$the_num_num']}>{$_POST['LT_$the_num_num']}</a>
EOT;

$n1+;
$the_num_num++;
i need to have a variable inside of the $_POST function
i hope this clears up the problems in my earilier question!!!!
thanks a bunch!!

Posted: Wed Jan 14, 2004 11:26 am
by twigletmac
Information in single quotes is not parsed:

Code: Select all

$foo = 'world';
echo "hello $foo";
outputs

Code: Select all

hello world
as does

Code: Select all

echo 'hello '.$foo;
but

Code: Select all

echo 'hello $foo';
outputs

Code: Select all

hello $foo
Try changing:

Code: Select all

$_POST['LU_$the_num_num']
to

Code: Select all

$_POST['LU_'.$the_num_num]
Mac

Posted: Wed Jan 14, 2004 11:33 am
by dull1554
thanks a million, i had thought i had allready tried that but i just did and it works perfectly!