Jump to content

Is it possible to use strips_tags to show a msg?


JJohnsenDK

Recommended Posts

Hey

Is 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?
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) ?
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>

<?php
if (isset($_POST['submit'])) {
    $tmp = strip_tags($_POST['headline']);

    if ($tmp != $_POST['headline'])
echo "You wrote wrong tags, remove them.";
}
?>[/code]

Ken

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.