Friends like that, I need your help, recently I venture into php.
I would like to capture data in a modal.
I generate a table with data from the database with some buttons, by clicking on those buttons I open a modal. I would like to capture the data obtained from the database and capture it in a txt. How could I do?
This is the table where I generate data
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Servicios de Unidad</h3>
<button type="submit" class="btn btn-success btn-xs pull-right" value="Añadir" data-toggle="modal" data-target="#modal-default"><i class="fa fa-plus"></i> Añadir</button>
</div>
<!-- /.box-header -->
<div class="box-body">
<table class="table table-bordered">
<tr>
<th style="width: 10px">#</th>
<th>Nombre Unidad</th>
<th>Objetivo</th>
<th>Acción</th>
</tr>
<?php
$con = ConexionBD();
$query= "SELECT * FROM unidades";
$ejecutar = mysqli_query($con,$query);
while($mostrar = mysqli_fetch_array($ejecutar))
{
?>
<tr>
<td><?php echo $mostrar['idunidades']; ?> </td>
<td><?php echo $mostrar['nombreu']; ?> </td>
<td><?php echo $mostrar['objetivou']; ?> </td>
<td width="300 px" align="Center">
<button type="button" class="btn btn-info btn-sm" id="editar" value="Asignar" data-toggle="modal" data-target="#modal-agregar" data-id=17><i class="fa fa-circle-o"></i> Asignar</button> <button type="button" class="btn btn-warning btn-sm" value="Editar" data-toggle="modal" data-target="#modal-default"><i class="fa fa-edit"></i> Editar </button> <button type="button" class="btn btn-danger btn-sm" value="Eliminar" data-toggle="modal" data-target="#modal-eliminar"><i class="fa fa-remove"></i> Eliminar</button></td>
</tr>
<?php
}
?>
</table>
</div>
This is the modal
<div class="modal fade" id="modal-agregar">
<div class="modal-dialog modal-bg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title">Detalle Unidad</h4>
</div>
<div class="modal-body">
<div class="box box-primary">
<form action="../Modelo/ModeloDetalleUnidad.php" method="POST" id="frmaval" name="frmaval" enctype="multipart/form-data" autocomplete="off">
<!-- Small boxes (Stat box) -->
<div class="box-body">
<div class="form-group">
<label for="lbloferta">Oferta: </label>
<input type="text" class="form-control" id="txtoferta" name="txtoferta" placeholder="Descripcion de la Red Social...">
</div>
<div class="form-group">
<label for="lbldescripciono">Descripción: </label>
<input type="text" class="form-control" id="txtdescripciono" name="txtdescripciono" placeholder="Descripcion de la Red Social...">
</div>
<div class="form-group">
<label for="lblfoto">Imagen: </label>
<input type="file" class="form-control" id="imagen" name="imagen" placeholder="Foto" accept="image/x-png,image/gif,image/jpeg">
</div>
<!-- <div class="form-group">
<label for="lblfoto">Logo de la Unidad:</label>
<input type="file" class="form-control" id="logou" name="logou" placeholder="Logo" accept="image/x-png,image/gif,image/jpeg">
</div>
<div class="checkbox">
<label>
<input type="checkbox"> Check me out
</label>
</div>-->
</div>
<!-- /.box-body -->
<div class="box-footer">
<input type="submit" name="Guardar" id="Guardar" value="Guardar" class="btn btn-primary">
</div>
</form>
</div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>