PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
spacebiscuit
Forum Contributor
Posts: 390 Joined: Mon Mar 07, 2005 3:20 pm
Post
by spacebiscuit » Fri Feb 19, 2010 9:23 am
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.
Darhazer
DevNet Resident
Posts: 1011 Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria
Post
by Darhazer » Fri Feb 19, 2010 9:43 am
What about:
Code: Select all
echo '<p class=list><b>Weight:</b>' . $_POST["weight{$y}"] .' kg</p>';
spacebiscuit
Forum Contributor
Posts: 390 Joined: Mon Mar 07, 2005 3:20 pm
Post
by spacebiscuit » Fri Feb 19, 2010 9:46 am
Thanks that worked, I used:
Code: Select all
echo"<p class=list><b>Dead Weight:</b> ".$_POST["weight{$y}"]." kg</p>";
Jonah Bron
DevNet Master
Posts: 2764 Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California
Post
by Jonah Bron » Tue May 18, 2010 7:59 pm
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.