Solved

PHP printing CSS error question

Posted on 2013-01-22
4
241 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
Comment Utility
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
Comment Utility
Thanks for the points and glad I was able to help.
0
 

Author Comment

by:TLN_CANADA
Comment Utility
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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now