Jump to content

what would be better way to remove any html related character from a form input


hakimserwa

Recommended Posts

Do you want to strip them, or cause them to display as text?

 

<?php

$string = '<br />';

echo $string;

echo "\n";

echo htmlentities($string);

?>

 

output

 

<br />
<br />

 

Works fine for me. Keep in mind, htmlentities and htmlspecialchars should be given an encoding value, if needed.

 

Please specify how you're using these functions.

 

<?php

$string = '<br/>';

echo strip_tags($string);

?>

 

Produces no output for me, so you probably aren't implementing it correctly.

Archived

This topic is now archived and is closed to further replies.

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