Solved

PHP printing CSS error question

Posted on 2013-01-22
4
249 Views
Last Modified: 2013-01-22
Hi everyone,

I know it's not the best practice but we need to print some CSS inside PHP like this

if ( $remind_status == 1 )
	{
		echo "<br><span style="padding:0 0 0 30px;
border-left:#0066cc 12px solid;
background-color:#3FA9F5;
padding:8px;
color:#FFF;
-webkit-border-radius: 0px 6px 6px 0px;
border-radius: 0px 6px 6px 0px;margin-left:30px;">You have an active reminder for every $remind_days days of inactivity!</span>";
	}

Open in new window


but it's giving the following error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/clear555/public_html/jstats.php on line 339 (line that starts with echo)

Could anyone tell us what we're doing wrong here?

Thanks,

D
0
Comment
Question by:TLN_CANADA
  • 3
4 Comments
 
LVL 7

Accepted Solution

by:
rgranlund earned 500 total points
ID: 38807113
it is your use of apostrophe's.
use this:

<?php
if ( $remind_status == 1 )
	{
		echo '<br><span style="padding:0 0 0 30px;
border-left:#0066cc 12px solid;
background-color:#3FA9F5;
padding:8px;
color:#FFF;
-webkit-border-radius: 0px 6px 6px 0px;
border-radius: 0px 6px 6px 0px;margin-left:30px;">You have an active reminder for every $remind_days days of inactivity!</span>';
	}
?>

Open in new window

0
 
LVL 7

Expert Comment

by:rgranlund
ID: 38807142
Thanks for the points and glad I was able to help.
0
 

Author Comment

by:TLN_CANADA
ID: 38807161
Thank you, one other small question with it if I may. The variable $remind_days inside the code is only printing as I guess it thinks its text inside this block. How could I adjust this so it prints the PHP variable here?
0
 
LVL 7

Expert Comment

by:rgranlund
ID: 38807490
You concantonate:
<?php
if ( $remind_status == 1 )
      {
            echo '<br><span style="padding:0 0 0 30px;
border-left:#0066cc 12px solid;
background-color:#3FA9F5;
padding:8px;
color:#FFF;
-webkit-border-radius: 0px 6px 6px 0px;
border-radius: 0px 6px 6px 0px;margin-left:30px;">You have an active reminder for every' . $remind_days.  'days of inactivity!</span>';
      }
?>
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question