开发者

What is the action attribute value for this scenario?

I have a form at http://example.com/register/ . I want this form to be processed b开发者_JAVA技巧y the current page. How would that be done? Is it action="../register/default.php" ?


You could just do...

<form action="?"> ... </form>

...which will submit it to itself.

If you really wanted to use PHP, you could do that, too...

<form 
 action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>">
    ...
</form>

This will echo the path after your domain that was used to access your page. It also includes GET params.


<FORM name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" >


You can leave the action parameter blank to submit to the same page.

<form action="" method="post"></form>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜