0

I see this in my code with method post but can't figure out what exactly it does.

<form action="." method="POST" class="form-vertical">
Ian Kirkpatrick
  • 1,722
  • 11
  • 25

2 Answers2

3

. is the current path segment of the current URL. In other words, it refers to the current relative URL.

If your current URL is http://example.com/foo/bar/baz/, then . refers to http://example.com/foo/bar/baz/ (yes, same URL).

It's a bit trickier without a trailing slash. On http://example.com/foo/bar/baz, . refers to http://example.com/foo/bar/. That's why it's not usually a good idea to use .; you could use action="" instead, which means action has an empty value, in which case the current (full) URL is substituted.

This . is pretty universal and is used in many contexts involving URLs or file paths.

deceze
  • 491,798
  • 79
  • 706
  • 853
0

Action normally specifies the file/page that the form is submitted to using the method described in the method parameter post or get.

. (dot) is the current path. you can try a demo here http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_form_submit

try to upload your form using action="." or action="" or action="/"

you will see the difference

Rahman
  • 121
  • 1
  • 6