Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does the form submit to if there is no action specified?

Tags:

forms

php

Here is the form that is confusing me

<h1>     Login </h1> <form action="" method="post">     <table align="left" border="0" cellspacing="0" cellpadding="3">         <tr>             <td>                 Username:             </td>             <td>                 <input type="text" name="user" maxlength="30">             </td>         </tr>         <tr>             <td>                 Password:             </td>             <td>                 <input type="password" name="pass" maxlength="30">             </td>         </tr>         <tr>             <td colspan="2" align="left">                 <input type="checkbox" name="remember">                 <font size="2">                     Remember me next time             </td>         </tr>         <tr>             <td colspan="2" align="right">                 <input type="submit" name="sublogin" value="Login">             </td>         </tr>         <tr>             <td colspan="2" align="left">                 <a href="register.php">Join</a>             </td>         </tr>     </table> </form> 

I got the code from this tutorial and it works fine but i cant seem to understand where a/the form submit too if no action is present

like image 985
Matt Elhotiby Avatar asked Apr 04 '11 03:04

Matt Elhotiby


People also ask

Can a form have no action?

A form without an action attribute is not a form, according to standards - and will actually cause a page reload in some browsers..

What is action in form submit?

The action attribute specifies where to send the form-data when a form is submitted.

What is the default action for form?

By default, the method attribute is set to “get”. This means that your form will send data over an HTTP GET request when it is submitted.

What is form action form?

The HTML form action attribute defines where to send the form data when a form is submitted in an HTML document.


1 Answers

If action is set to "" or if the action attribute is missing, the form submits to itself. That is, if your script is index.php, your form submits to index.php.

like image 73
Jimmy Sawczuk Avatar answered Sep 22 '22 16:09

Jimmy Sawczuk