Jump to content

not allowing html in a text area ...


imarockstar

Recommended Posts

I have a form that allows people to post content in a regular TEXTAREA :

 

<h2 class='boxtitle'>Meta Description</h2>
<textarea class=editblocktext name='metadesc' >
<? echo $rows['metadesc']; ?>
</textarea> 
<br><br>

 

but I do not want the user to throw any html,css,php or javascript in there .. how can this be prevented ?

 

thx

b

 

 

Link to comment
https://forums.phpfreaks.com/topic/136728-not-allowing-html-in-a-text-area/
Share on other sites

awesome .. i knew it was something like that .. I just had the wrong function ..

 

what would be the correct IF statement to send an error message that you entered HTML and that it is not allowed ?

 

like --

 

IF 'html code is entered'
echo "you can not enter html code";

 

 

 

Try:

 

if(strip_tags($string)){

 

echo 'No HTML!';

 

}

 

Otherwise, you'll mostlikely need to search the string for a <> pair and return the error.

 

I would just put a notice above the textbox.

 

 

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.