Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8670537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:43:47+00:00 2026-06-12T18:43:47+00:00

I am setting the value of a php variable to some html. i.e. $_img

  • 0

I am setting the value of a php variable to some html. i.e.

$_img = '<a href="some url">hehehehehe</a>';

The variable is then shown in html after a br tag. But it doesn’t execute the html in it. Rather it displays it like <a href="some url">hehehehehe</a>. So, is there any problem in my code! How can i do this thing?

Here is the code that displays that IN HTML,

 <?php if ($_item->getComment()): ?> <br/><?php echo $this->escapeHtml($_item->getComment(), array('b','br','strong','i','u')) ?> <?php endif; ?> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T18:43:49+00:00Added an answer on June 12, 2026 at 6:43 pm

    From your comment….

    Here is the code that displays that <?php if ($_item->getComment()):
    ?> <br/><?php echo $this->escapeHtml($_item->getComment(),
    array('b','br','strong','i','u')) ?> <?php endif; ?>

    As predicted by many people, it looks like you are encoding the value when you display it.

    I don’t know what the $this->escapeHtml function is doing exactly, but it would appear to be doing an HTML Encoding on the string.

    The result being that any tag, for example <a> will be sent to the browser as &lt;a&gt; which the browser will display as <a>. The browser will not see it as a tag, and will therefore not treat it as one.

    So the simple answer is: don’t encode the HTML…

    <?php echo $_item->getComment(); ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am setting a PHP variable's value as false. Then after some processing I
After setting up a mysqli object in php, i want to make to insert
Possible Duplicate: PHP: Notice: Undefined variable and Notice: Undefined index In html code: <select
I am having problem setting a variable in PHP for multiple use into if
I've written a module that depends on an overridden value in $conf in settings.php.
Im setting a value in viewDidLoad so it can be a default settings, so
Does setting this value have the same effect as setting the debug=true in the
I am setting the value of a textbox via javascript client-side. When I refresh
I have a for-loop which is setting the value of the progress bar on
I am using jQuery UI Selectmenu and am having trouble setting the value of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.