Page 1 of 1

Echo

Posted: Fri Feb 19, 2010 9:23 am
by spacebiscuit
I'm having trouble with this line of code:

Code: Select all

echo"<p class=list><b>Weight:</b>$_POST["."weight{$y]"."] kg</p>";
I've also tried:

Code: Select all

echo"<p class=list><b>Weight:</b>$_POST[".weight{$y]."] kg</p>";
and....

Code: Select all

echo"<p class=list><b>Weight:</b>$_POST[".'weight{$y]'."] kg</p>";
This always gets me and I have no idea how to solve it. Any help would be appreciated.

Thanks,

Rob.

Re: Echo

Posted: Fri Feb 19, 2010 9:43 am
by Darhazer
What about:

Code: Select all

echo '<p class=list><b>Weight:</b>' . $_POST["weight{$y}"] .' kg</p>';

Re: Echo

Posted: Fri Feb 19, 2010 9:46 am
by spacebiscuit
Thanks that worked, I used:

Code: Select all

echo"<p class=list><b>Dead Weight:</b> ".$_POST["weight{$y}"]." kg</p>";

Re: Echo

Posted: Tue May 18, 2010 3:41 pm
by spacebiscuit
Ok I got it!

Code: Select all

echo"<b>".$_SESSION['del'][1].";

Re: Echo

Posted: Tue May 18, 2010 7:59 pm
by Jonah Bron
That won't work. You have an unclosed string.

Code: Select all

// it has to be like this
echo "<b>".$_SESSION['del'][1];
// or this
echo "<b>".$_SESSION['del'][1]."";
The second is pointless; it's just there to show how to close the string.