Reputation: 31
i have problem here, this is mi code: tried to send the form data to another PHP file where it receives them and uploads to the sql server but it seems not to work
<form id="modal" action="revisaorden.php" method="post">
<form id="modal" action="revisaorden.php" method="post" >
<div class="form-group">
<label for="nombre">Nombre</label>
<input type="text" class="form-control" name="nombre" id="nombre" placeholder="Nombre" required>
<div class="invalid-feedback">
Ingrese su nombre.
</div>
</div>
<div class="form-group">
<label for="direccion">Direccion</label>
<input type="text" class="form-control" name="direccion" id="direccion" placeholder="Direccion" required>
<div class="invalid-feedback">
Ingrese su direccion.
</div>
</div>
<div class="form-group">
<label for="telefono">Telefono</label>
<input type="tel" class="form-control" name="telefono" id="telefono" placeholder="Telefono" required>
<div class="invalid-feedback">
Ingrese su numero de telefono.
</div>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" name="email" id="email" placeholder="Email" required>
</div>
<div class="form-group">
<label for="observaciones">Observaciones</label>
<textarea type="textarea" class="form-control" name="observaciones" id="observaciones" placeholder=""></textarea>
</div>
<div class="form-group">
<label for="txtCambio">Requiero cambio de:</label>
<input type="text" class="form-control" name="txtCambio" id="txtcambio">
</div>
<div class="modal-footer ">
<button type="submit" onclick="location.href='revisaorden.php?$total=<?php echo $total ?>&$cantidad=<?php echo $cantidad ?>&$item=<?php echo $item ?>&nombre&direccion&telefono&email&observaciones&txtcambio'" class="btn btn-primary" data-dismiss="modal">Enviar</button>
</div>
</form>
</form>
here you should send in POST the form data to the following file: revisaorden.php with the following code to read them.
<?php
//codigo para el envio de los datos al sistema
$v1 = ($_GET['nombre']);$v2 = ($_GET['direccion']);$v3 = ($_GET['telefono']);$v4 = ($_GET['email']);$v5 = ($_GET['observaciones']);
$v6 = ($_GET['txtcambio']);
$v7 = ($_GET['$item']);
$v8 = ($_GET['$cantidad']);
$v9 = ($_GET['$total']);
/* Here the data is uploaded to the server
$client = new Clientes();
$client->addClientes($v1, $v2, $v3, $v4);
//echo $client;*/
echo $v1,$v2,$v3,$v4,$v5,$v6,$v7,$v8,$v9;
?>
Upvotes: 0
Views: 81
Reputation: 461
this form is <form id="modal" action="revisaorden.php" method="post">
you must use $_POST to receive data, like this.
$v1 = ($_POST['nombre']);
$v2 = ($_POST['direccion']);
$v3 = ($_POST['telefono']);
$v4 = ($_POST['email']);
$v5 = ($_POST['observaciones']);
$v6 = ($_POST['txtcambio']);
$v7 = ($_POST['$item']);
$v8 = ($_POST['$cantidad']);
$v9 = ($_POST['$total']);
to receive data.
Upvotes: 1