Error sending form by POST in php

0

I have a form that I want to send by post, in which I have several hidden inputs with variables ...

<input type="hidden" name="idUsuario" value="<?php echo $IdUsuario ?>">
<input type="hidden" name="nombre" value="<?php echo $nombre ?>">
<input type="hidden" name="email" value="<?php echo $email ?>">
<input type="hidden" name="telefono" value="<?php echo $telefono ?>">

but at the moment of sending it to the other page it marks me errors on index

How can I solve the problem? I need those variables to be able to enter data in the database

That's how I try to receive

$nombre = $_POST['nombre'];
$correo = $_POST['email'];
$IdUsuario =$_POST['idUsuario'];
$telefono = $_POST['telefono'];
  

Form

<div class="form">
      <form action="" method="POST" id="card-form">
        <span class="card-errors"></span>
        <div>
          <label>
            <span>Nombre</span><br>
          </label>
        </div>
        <div>
          <label>
            <span>Número</span><br>
          </label>
        </div>
        <div>
          <label>
            <span>Fecha(MM/AAAA)</span><br>
          <span>/</span>
          </label>
        </div>
        <div>
          <label>
          </label>
        </div>
        <input type="hidden" name="idUsuario" value="<?php echo $IdUsuario ?>">
        <input type="hidden" name="nombre" value="<?php echo $nombre ?>">
        <input type="hidden" name="email" value="<?php echo $email ?>">
        <input type="hidden" name="telefono" value="<?php echo $telefono ?>">
        <button type="submit">Crear Token</button>
      </form>
  

Send data to the next page

var SuccessResponseHandler = function(token) {
    var $form = $("#card-form");
    //Inserta el token_id en la forma para que se envíe al servidor
    $form.append($('<input name="id_token" id="TokenId" type="hidden">').val(token.id));
    //$form.get(0).submit(); //Hace submit
    var formData = new FormData(document.getElementById("card-form"));
    //Llamamos a la función AJAX de jQuery
    $.ajax({
      url: "customer.php",
      type: "POST",
      dataType: "html",
      data: formData,
      cache: false,
      contentType: false,
      processData: false
    }).done(function(echo){
       alert("Pago exitoso");
    });
};
    
asked by cesg.dav 29.12.2017 в 21:30
source

0 answers