strip_tags in PHP
Posted: Thu Jul 24, 2008 6:53 am
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Can someone tell me what is the use of strip_tags(); As per my knowledge the function of strip_tags() is to remove all HTML and PHP tags from a given string, but when i am enter <p>Test paragraph.</p><!-- Comment --> Other text in text box then i getting blank out put.
FYI this is my code:
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Can someone tell me what is the use of strip_tags(); As per my knowledge the function of strip_tags() is to remove all HTML and PHP tags from a given string, but when i am enter <p>Test paragraph.</p><!-- Comment --> Other text in text box then i getting blank out put.
FYI this is my code:
Code: Select all
<?
function secured($val)
{
if(empty($val) or strlen($val) > 40)
{
return false;
} else {
$val = strip_tags(trim(($val)));
echo $val; exit;
$val = escapeshellcmd($val);
return stripslashes($val);
}
}
if(isset($_POST['Submit']))
{
$securityscript = $_POST['securityscript'];
echo secured($securityscript);
}
?>
<form name="test" method="post" action="secureTextBox.php">
<input type="text" name="securityscript">
<input type="submit" name="Submit" value="Submit">
</form>[code=text][code][/code][/code]~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: