Page 1 of 1

span style question

Posted: Thu Mar 20, 2008 3:17 pm
by gammaman
How would I get span style to work in the following context. Mine has an error.

Code: Select all

 
echo "<span style = "color:red">" $firstname.'&nbsp;'.$lastname</span>.':';
 

Re: span style question

Posted: Thu Mar 20, 2008 3:22 pm
by andym01480

Code: Select all

echo '<span style = "color:red">'.$firstname.'&nbsp;'.$lastname</span>.':';

Re: span style question

Posted: Thu Mar 20, 2008 3:22 pm
by Zoxive
gammaman wrote:How would I get span style to work in the following context. Mine has an error.

Code: Select all

 
echo "<span style = "color:red">" $firstname.'&nbsp;'.$lastname</span>.':';
 
You need to escape those quotes.

Code: Select all

echo "<span style = \"color:red\">{$firstname}&nbsp;{$lastname}</span>:";
OR

Code: Select all

echo '<span style = "color:red">' . $firstname . '&nbsp;' . $lastname . '</span>:';

______
andym01480 wrote:

Code: Select all

echo '<span style = "color:red">'.$firstname.'&nbsp;'.$lastname . '</span>:';
Still wrong at the end, </span> was not quoted.

Re: span style question

Posted: Thu Mar 20, 2008 3:31 pm
by andym01480
oops too quickly done