Hi, I am doing a dining room control system but I have a problem, there is an input in which the employee code will be inserted by means of a bar code reader, but I do not know how to save this information in a variable to show the data of the employee who checked his card, my search code is this:
$query_empresa=mysqli_query($con,"select * from empleados where no_emp='1'");
$row=mysqli_fetch_array($query_empresa);
where no_emp = '1' should the variable be inserted, could someone explain how to save this information using javascript? below my full code
<?php
/*-------------------------
Autor: INNOVAWEBSV
Web: www.innovawebsv.com
Mail: [email protected]
---------------------------*/
session_start();
if (!isset($_SESSION['user_login_status']) AND $_SESSION['user_login_status'] != 1) {
header("location: login.php");
exit;
}
require_once ("config/db.php");//Contiene las variables de configuracion para conectar a la base de datos
require_once ("config/conexion.php");//Contiene funcion que conecta a la base de datos
$active_facturas="active";
$active_productos="";
$active_clientes="";
$active_usuarios="";
$title="Facturas | Simple Invoice";
$query_empresa=mysqli_query($con,"select * from empleados where no_emp='1'");
$row=mysqli_fetch_array($query_empresa);
?>
Configuration
<div class="panel-body">
<div class="row">
<form class="form-horizontal" role="form" id="datos_cotizacion">
<div class="form-group row">
<label for="q" class="col-md-2 control-label">Departamento o # de empleado</label>
<div class="col-md-5">
<input type="text" class="form-control" id="q" placeholder="Nombre del departamento # de empleado" onkeyup='load(1);'>
</div>
<div class="col-md-3">
<button type="button" class="btn btn-default" onclick='load(1);'>
<span class="glyphicon glyphicon-search" ></span> Buscar</button>
<span id="loader"></span>
</div>
</div>
</form>
<div class="col-md-3 col-lg-3 " align="center">
<div id="load_img">
<img class="img-responsive" src="<?php echo $row['img_emp'];?>" alt="Logo">
</div>
<br>
<div class="row">
</div>
</div>
<div class=" col-md-9 col-lg-9 ">
<table class="table table-condensed">
<tbody>
<tr>
<input type="hidden" name="id_perfil" value="<?php echo $_SESSION['user_id']?>">
</tr>
<tr>
<td class='col-md-3'>No Emp:</td>
<td><input type="text" class="form-control input-sm" name="no_emp" value="<?php echo $row['no_emp']?>" required></td>
</tr>
<tr>
<td>Nombre:</td>
<td><input type="text" class="form-control input-sm" name="nombre_emp" value="<?php echo $row['nombre_emp']?>" readonly></td>
</tr>
<tr>
<td>Departamento:</td>
<td><input type="text" class="form-control input-sm" name="dep_emp" value="<?php echo $row['dep_emp']?>" readonly></td>
</tr>
<tr>
<td>Confidencialidad:</td>
<td><input type="text" class="form-control input-sm" name="empresa_emp" value="<?php echo $row['empresa_emp']?>" readonly></td>
</tr>
<tr>
<td>Fecha de Ingreso:</td>
<td><input type="text" class="form-control input-sm" name="fecha" value="<?php echo date('d-M-Y',strtotime($row['ing_emp'])) ?>" readonly></td>
</tr>
</tbody>
</table>
</div>
<div class='col-md-12' id="resultados_ajax"></div><!-- Carga los datos ajax -->
</div>
</div>
<button type="submit" class="hidden"><i class="glyphicon glyphicon-refresh"></i> Actualizar datos</button>
</div>
</div>
</form>