Reputation: 4469
In my cakephp project I am trying to show a link from a database table.
Here is the text field. Here I have sent a link in my database table
After Inserting this link my database table looks like the image below
Now the problem is when I want to see this link in my view page It's showing something like the image below
This is my view code --
<div>
<p style="font-size: 1.0em;">
<?php echo h($notice['Notice']['description']); ?>
</p>
</div>
Now my questions are:
How can I show the link?
Is there any role in mysql query for showing link?
I have used data type text is this the right way?
Upvotes: 0
Views: 92
Reputation: 21563
Your HTML link is being escaped by the h function that your are using to print it.
See http://api.cakephp.org/2.2/function-h.html
Text to wrap through htmlspecialchars
And what's htmlspecialchars?
https://www.php.net/htmlspecialchars
It means it turns special characters which have meaning in html code into their entity representations, such as '>' for '>'. This means they are printed on screen the way they appear in the code instead of actually becoming HTML tags.
Instead of running the data through the h function, simply echo it.
<div>
<p style="font-size: 1.0em;">
<?php echo $notice['Notice']['description']; ?>
</p>
</div>
Upvotes: 2