shage Posted October 3, 2007 Share Posted October 3, 2007 echo '<LINK REL = "STYLESHEET" TYPE "text/css" HREF ="$myRandomText.css">'; what am i doing wrong there, Im trying to echo the $myrandomtext i know that dont look right but hey im new please and thank you Quote Link to comment Share on other sites More sharing options...
micah1701 Posted October 3, 2007 Share Posted October 3, 2007 when including a PHP variable inside an outputted HTML string, you either need to encase the whole thing in double quotes, or break out of the string. either of these will work: <?php echo "<LINK REL = \"STYLESHEET\" TYPE \"text/css\" HREF =\"$myRandomText.css\">"; // or echo '<LINK REL = "STYLESHEET" TYPE "text/css" HREF ="'.$myRandomText.css.'">'; ?> EDIT -- to better explain: <?php $var = "world"; echo "hello $var"; //outputs: hello world echo 'hello $var'; //outputs: hello $var echo 'hello '.$var; //outputs: hello world ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.