在我的应用程序中,我有localhost/controller/action
(MVC)。我打开一个页面localhost/user/register
。我有一个表格。令人惊讶的是,当我使用<form action="<?php echo $_SERVER[PHP_SELF];?>" >
提交表单时,表单提交会将我重定向到localhost/index.php
我想将其重定向到相同的网址localhost/user/register
,当我提交表单时如何才能实现此目标
答案 0 :(得分:0)
将表单的action属性保留为空。
<form method="post"></form>
它将在当前网址中提交。