0

fname値の入力されたすべてのテキストをテキストとしてエコーし、html、js、またはphpのテキストのみをエコーするようにtest.phpで検証するにはどうすればよいですか

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

2 に答える 2

0

htmlspecialchars()またはhtmlentities()あなたが必要なものを達成します。

例:

if (isset($_POST['txtExample'])) {
    echo(htmlentities($_POST['txtExample']), ENT_QUOTES));
}

幸運を。

于 2013-02-14T02:18:26.190 に答える
0

this is the key
htmlspecialchars()

于 2013-02-14T02:00:09.840 に答える