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>
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>
htmlspecialchars()
またはhtmlentities()
あなたが必要なものを達成します。
例:
if (isset($_POST['txtExample'])) {
echo(htmlentities($_POST['txtExample']), ENT_QUOTES));
}
幸運を。
this is the key
htmlspecialchars()