[PHP] Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in
Hi All, I get the error for line 15 for this code, ?php 15 echo font face='$_SESSION['font']'; 16 echo size='$_SESSION['size']'; 17 echo color='$_SESSION['colour']'; 18 echo $_SESSION['text']; 19 echo /font; 20 ? I have put ' ' quotes around the quotes for each font attribute so that the parser doesn't think the echo is finished too early. Is that wrong? I know that this code would get tedious for lots of text and CSS would be better, but, it's just a little study project from the book I'm following. Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in
Mark Sargent wrote: Hi All, I get the error for line 15 for this code, ?php 15 echo font face='$_SESSION['font']'; 16 echo size='$_SESSION['size']'; 17 echo color='$_SESSION['colour']'; 18 echo $_SESSION['text']; 19 echo /font; 20 ? I have put ' ' quotes around the quotes for each font attribute so that the parser doesn't think the echo is finished too early. Is that wrong? I know that this code would get tedious for lots of text and CSS would be better, but, it's just a little study project from the book I'm following. Cheers. Mark Sargent. any of these will work: echo font face='.$_SESSION['font'].'; //note the . before and after the variable. echo font face='{$_SESSION['font']}'; echo font face='$_SESSION[font]';//no quotes around the index key ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in
Mark Sargent wrote: Hi All, I get the error for line 15 for this code, ?php 15 echo font face='$_SESSION['font']'; 16 echo size='$_SESSION['size']'; 17 echo color='$_SESSION['colour']'; 18 echo $_SESSION['text']; 19 echo /font; 20 ? I have put ' ' quotes around the quotes for each font attribute so that the parser doesn't think the echo is finished too early. Is that wrong? I know that this code would get tedious for lots of text and CSS would be better, but, it's just a little study project from the book I'm following. Cheers. Mark Sargent. Hi All, sorry, I forgot the fundamentals again, . variableName . echo font face=' . $_SESSION['font'] . '; and no around the variable in an echo statement when no other text in it. echo $_SESSION['text']; Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php