Jump to content

[SOLVED] Question


shage

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.