JJohnsenDK Posted November 20, 2006 Share Posted November 20, 2006 HeyIs it possible to use strips_tags to show a msg?Eksemple:[code]<form> Headline<br /> <input type="text" name="headline" /> <br /> <input type="submit" name="submit" value="submit" /></form><?php$_POST['headline'] = strip_tags($_POST['headline']);if (strip_tags($_POST['headline'])){ echo "You wrote wrong tags, remove them.";}?>[/code]The eksemple doesnt work, but i think it explain what i want. Is it somehow possible to use strip_tags as i did in the eksemple? Link to comment https://forums.phpfreaks.com/topic/27902-is-it-possible-to-use-strips_tags-to-show-a-msg/ Share on other sites More sharing options...
The Little Guy Posted November 20, 2006 Share Posted November 20, 2006 strip_tags removes all tags from the html, and that is it. so... could you maybe explain more in depth of what you want? Link to comment https://forums.phpfreaks.com/topic/27902-is-it-possible-to-use-strips_tags-to-show-a-msg/#findComment-127585 Share on other sites More sharing options...
JJohnsenDK Posted November 20, 2006 Author Share Posted November 20, 2006 If a person have entered html tags in the form text and press submit, i want to inform the person that he/she have entered html tags, via a msg. You know like when you use the empty function:[code]<?php if (empty($_POST['news_text'])){ echo "<br /><br /><font color='#FF0000'>You didnt write any text. Plz do so</font>";}?>[/code]Is it possible to tell the user that he/she have entered some illegal codes(html tags) ? Link to comment https://forums.phpfreaks.com/topic/27902-is-it-possible-to-use-strips_tags-to-show-a-msg/#findComment-127595 Share on other sites More sharing options...
kenrbnsn Posted November 20, 2006 Share Posted November 20, 2006 You could do something like this:[code]<form method="post"> Headline<br /> <input type="text" name="headline" /> <br /> <input type="submit" name="submit" value="submit" /></form><?phpif (isset($_POST['submit'])) { $tmp = strip_tags($_POST['headline']); if ($tmp != $_POST['headline']) echo "You wrote wrong tags, remove them.";}?>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/27902-is-it-possible-to-use-strips_tags-to-show-a-msg/#findComment-127597 Share on other sites More sharing options...
JJohnsenDK Posted November 21, 2006 Author Share Posted November 21, 2006 That looks like something i can use :D .... Thanks alot! Link to comment https://forums.phpfreaks.com/topic/27902-is-it-possible-to-use-strips_tags-to-show-a-msg/#findComment-127830 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.