Jump to content

Recommended Posts

I just started learning PHP and I am trying to read form data and then display it using echo. Here is what I am using

 

echo $row["title"];

 

If I want to display it in let say red color how can I do that?

 

I have trued

 

echo "<font color="#660000">$row["title"]</font>;

 

but it gives error. Can someone please help me.

Link to comment
https://forums.phpfreaks.com/topic/71220-solved-color-echo/
Share on other sites

You need to use backslashes in the echo statement so it looks like this:

echo "<font color=\"#660000\">$row[\"title\"]</font>";

or change the double quotations inside the statement to single quotations:

echo "<font color='#660000'>$row['title']</font>";

Does that fix it?

Link to comment
https://forums.phpfreaks.com/topic/71220-solved-color-echo/#findComment-358235
Share on other sites

echo "<font color='#660000'>$row['title']</font>";

 

paste your error if this doesn't work

 

When I try this I get following error

 

PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE,expecting T_STRING or T_VARIABLE or T_NUM_STRING

 

 

I am getting same error i.e.

 

PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE,expecting T_STRING or T_VARIABLE or T_NUM_STRING

 

Link to comment
https://forums.phpfreaks.com/topic/71220-solved-color-echo/#findComment-358239
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.