处理表单输入
根据请求方法决定做什么
<!-- 如果请求方法是GET,显示表单 -->
<form action="<?php echo htmlentities($_SERVER['SCRIPT_NAME']) ?>" method="post">
<!-- 表单的action属性设置为当前脚本的名称,确保表单数据提交回此脚本 -->
<!-- 使用htmlentities函数对$_SERVER['SCRIPT_NAME']进行转义,防止XSS攻击 -->
<p>What is your first name?</p>
<!-- 询问用户的名字 -->
<input type="text" name="first_name" />
<!-- 输入框,用户输入他们的名字,名字存储在名为first_name的变量中 -->
<input type="submit" value="Say Hello" />
<!-- 提交按钮,当用户点击时,表单数据将通过POST方法提交 -->
</form>
浙公网安备 33010602011771号