Atributo action de <form> en HTML

Definición y uso

action El atributo especifica a dónde enviar los datos del formulario al presentar el formulario.

Ejemplo

En el proceso de presentación del formulario, envía los datos del formulario al archivo llamado "action_page.php" (usado para procesar la entrada):

<form action="/action_page.php" method="get">
  <label for="fname">Nombre:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">Apellido:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <input type="submit" value="Enviar">
</form>

Intente hacerlo usted mismo

Sintaxis

<form action="URL">

Valor del atributo

Valor Descripción
URL

Se especifica dónde enviar los datos del formulario al enviarlo.

Valores posibles:

  • URL absoluta - Se refiere a otro sitio web (por ejemplo, action="http://www.example.com/example.html")
  • URL relativa - Se refiere a un archivo dentro del sitio web (por ejemplo, action="example.html")

Compatibilidad del navegador

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Soporte Soporte Soporte Soporte Soporte