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 Link to comment https://forums.phpfreaks.com/topic/71687-solved-question/ 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 ?> Link to comment https://forums.phpfreaks.com/topic/71687-solved-question/#findComment-360883 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.