可以使用PHP自身的$_SERVER["PHP_SELF"]
来将表单提交给自己。具体代码如下:
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<!-- 表单内容 -->
<input type="submit" name="submit" value="提交">
</form>
这里的action
属性将表单提交到当前页面。当用户点击提交按钮时,表单数据将被发送到当前页面,然后可以使用PHP代码来处理提交的数据。