php输入后验证

php输入后验证,php,validation,Php,Validation,如何在test.php上进行验证,以将fname值的所有输入文本作为文本进行回显,并仅将其作为html、js或php的文本进行回显 <html> <body> <form action="test.php" method="POST"> Enter Your name : <input type="text" name="fname"> <input type="submit"> </form> </body>

如何在test.php上进行验证,以将fname值的所有输入文本作为文本进行回显,并仅将其作为html、js或php的文本进行回显

<html>
<body>
<form action="test.php" method="POST">
Enter Your name : <input type="text" name="fname">
<input type="submit">
</form>
</body>
</html>

输入您的姓名:
这是关键
htmlspecialchars()

或将实现您需要的功能

例如:

if (isset($_POST['txtExample'])) {
    echo(htmlentities($_POST['txtExample']), ENT_QUOTES));
}
祝你好运。

请看。