Button that does not work

0

Hello everyone and thanks in advance. I have a simple form with Nombre , email , Mensaje and a Send button. The code of the button is:

  <div class="form-field col x-100 align-center">
         <input class="submit-btn" type="submit" value="Enviar">
  </div>

The problem is that I do not see how to include the action for more than I've tried. Any suggestions?

    
asked by Juanjo 13.04.2018 в 12:10
source

2 answers

1

I'll let you know how it would be to submit a form.

<form action="pagina.php">
  First name:<br>
  <input type="text" name="firstname" value="Mickey">
  <br>
  Last name:<br>
  <input type="text" name="lastname" value="Mouse">
  <br><br>
  <input type="submit" value="Submit">
</form>

The action is where the page will go when you click on the button, the button of the form must have the attribute type="submit" so do the postback.

Be careful with the quotes in the attributes.

Edit : I see that you have added code to the question that was not before.

You have a button that has a type submit , but I do not see that it is inside a form . If the button is not inside a form it does not submit, in the form it is where you specify where the form will go.

Edit 2:

The action goes inside the main form tag. Here you have the documentation of how it works.

   <form class="contact-form row" action="pagina.php">
      <div class="form-field col x-50">
         <input id="name" class="input-text js-input" type="text" required>
         <label class="label" for="name">Name</label>
      </div>
      <div class="form-field col x-50">
         <input id="email" class="input-text js-input" type="email" required>
         <label class="label" for="email">E-mail</label>
      </div>
      <div class="form-field col x-100">
         <input id="message" class="input-text js-input" type="text" required>
         <label class="label" for="message">Message</label>
      </div>
      <div class="form-field col x-100 align-center">
         <input class="submit-btn" type="submit" value="Submit">
      </div>
   </form>
    
answered by 13.04.2018 в 12:31
0

The action does not go on the button, but on the header of the form.

   <form action=tupagina.php>
         ... (resto de código)
   <button name="Este es el botón"></button>
   </form>
    
answered by 13.04.2018 в 12:17