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>
精彩评论