When I have a form like this:
<form method="post" action=".">
What does the "." in action stand for?
When I have a form like this:
<form method="post" action=".">
What does the "." in action stand for?
The action
attributes tell the form where to post the form data to.
.
Stands for current directory, so I would say this posts to the default document in the current directory.
There are several notations for relative paths:
..
stands for parent directory.
stands for current directory/
stands for root directory if the URI starts with it/
stands for child directory if the URI does not start with itAs @Oded said the action
attribute tells where the form data will submit. In your case, the dot represents the current directory, so it doesn't submit data to any particular file which is not how it should be.
Hi! The "." means that the form will be calling the default page of the current directory. It's not a common way to specify this, though.
More commonly you'll see things like those:
<form method="post" action="index.php">
<form method="post" action="/a/path/to/file.asp">
<form method="post" action="/">
The last one does something similar as the dot. It calls the default page in the root folder of your website.
Here is a good script to submit data automatically to the user. It also has an example html file that shows the action part in use correctly.