Jump to content

How to paste text in HTML when it's in htmlspecialchars


Mudsaf
 Share

Recommended Posts

Wondering how to get this to pure html code that works on page. For example

<a href=&#039;http://www.facebook.com/#$LINK$&#039; target=&#039;_blank&#039;>ROFLCOPTER</a>

The $LINK + text has been changed on that since i dont wan't to reveal code from my websites ATM im using

$header1 = htmlspecialchars_decode($row1['$BLABLA$']);

But its still pasting header like this on the page<a href='http://www.facebook.com/#LINK' target='_blank'>ROFLCOPTER</a>

  • Like 2
Link to comment
Share on other sites

Try html_entity_decode() instead.

$header1 = html_entity_decode($row1[$BLABLHA],ENT_QUOTES));

Link to comment
Share on other sites

No different effect since it decodes the HTML correctly but it won't show it as html. Instead it shows it like this

<a href='http://www.facebook.com/#LINK' target='_blank'>ROFLCOPTER</a>

Edited by Mudsaf
Link to comment
Share on other sites

Wondering how to get this to pure html code that works on page.
No different effect since it decodes the HTML correctly but it won't show it as html.
I'm confused. You say you want to decode it, but when it decodes the HTML, it now won't show the HTML?
Link to comment
Share on other sites

Yes thats correct Shows like this<a href='http://google.com' target='_blank'>http://google.com</a> when it should show it like thishttp://google.com/ PHP code looks like this (incase this helps you)

include 'inc/yhdista_tietokanta.php'; //Conncets to DB$query1 = "SELECT * FROM $table$ WHERE $column$ = '$text$' ORDER BY $column$ DESC LIMIT 1";$query2 = "SELECT * FROM $table$ WHERE $column$ = '$text$' ORDER BY $column$ DESC LIMIT 1";$result1 = mysql_query($query1);$result2 = mysql_query($query2);if (!$result1 || !$result2) {echo "There was error, try again later.";} else {$row1 = mysql_fetch_array($result1);$row2 = mysql_fetch_array($result2);$header1 = html_entity_decode($row1['$column$'], ENT_QUOTES);$text1 = html_entity_decode($row1['$column$'], ENT_QUOTES);$header2 = html_entity_decode($row2['$column$'], ENT_QUOTES);$text2 = html_entity_decode($row2['$column$'], ENT_QUOTES);echo "Header: " . $header1 . " <br>Added: " .  $row1['$column$'];echo "</span></span></span>";echo "<p>" . $text1 . "</p>";echo "</a><a href='#'class='klink'>Continue to ... $linkplace$ >></a> </span></span><br>";

blablablala until it closes tags } + php every tag inside $$ is correct information, but since i didin't want reveal site coding i added $$. ... Variables $something2 are used later with same method Mispelled "Should" so had to update

Edited by Mudsaf
Link to comment
Share on other sites

Somehow i managed to ruin my whole database when trying to solve this . . . so lucky i've backed up this database/website few times. (Effect: Small rollback) -Somehow problem fixed with backup and other stuff xD dnno what the problem was but working now!

Edited by Mudsaf
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...