HTML inside PHP Question

Hi everyone,

I want to change the colour of this text displayed.

	echo "<h1>Successfully added!</h1><br><br>";

Open in new window

Please can someone tell me how to do this.


Who is Participating?
Robert SchuttConnect With a Mentor Software EngineerCommented:
that's because of the quotes. you have to escape or alternate with single quotes.
echo "<h1 style='color: green;'>Successfully added!</h1><br><br>";

Open in new window

Robert SchuttSoftware EngineerCommented:
you can use a class, or an inline style
<h1 style="color: green;">

Open in new window

TLN_CANADAAuthor Commented:
Here is what I've tried but it doesn't work :

      echo "<h1 style="color: green;">Successfully added!</h1><br><br>";

It's a phpfox script so sometimes it is very particular about the syntax. Could you suggest another method of doing this?

Thanks for your help,

Ray PaseurCommented:
it doesn't work
As far as I can recall there is no such error message from PHP!  

No points for this, please -- robert_schutt has given you the correct answer.  But going forward, please follow the guidance of the SSCCE when you post questions.  It will make for quicker, more accurate answers.  In PHP, that means raising the error reporting level and the display errors level, and then showing us the exact error message and the exact line number of the error message.  In the instant case you probably got a "Parse error" and knowing that information leads us to better answers more quickly.
TLN_CANADAAuthor Commented:
Thank you Ray, I will be sure to post this in the future.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.