pr fin el problema se slucin ha quedado así:
pagina 1
Código HTML:
Ver original<?php
header("Content-Type: text/html;charset=utf-8");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es"> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> <link rel="stylesheet" type="text/css" media="screen" href="cssPageGrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="tema/css/custom-theme/jquery-ui-1.8.23.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" /> <link rel="stylesheet" type="text/css" media="screen" href="css/ui.multiselect.css" />
<script src="js/jquery.min.js" type="text/javascript"></script> <script src="js/jquery-ui-custom.min.js" type="text/javascript"></script> <script src="js/jquery.layout.js" type="text/javascript"></script> <script src="js/i18n/grid.locale-es.js" type="text/javascript"></script> <script type="text/javascript"> $.jgrid.no_legacy_api = true;
$.jgrid.useJSON = true;
<script src="js/ui.multiselect.js" type="text/javascript"></script> <script src="js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="js/jquery.tablednd.js" type="text/javascript"></script> <script src="js/jquery.contextmenu.js" type="text/javascript"></script> <form action="entradaArticulo.php" method="post"> <input name="cBar" id="cBar" type="text" size="20" maxlenght="200" autofocus required/> $(function() {
$( "#fechaFactura" ).datepicker({
showOtherMonths: true,
selectOtherMonths: true,
dateFormat:'dd/mm/yy',
firstday:1
});
$('#fecha').datepicker($.datepicker.regional['es']);
});
<input type="text" id="fechaFactura" name="fechaFactura" maxlenght="5" required/>
<input name="numSer" id="numSer" type="text" size="30" maxlenght="20" required/><br/>
$(document).ready(function(){
$('#cBar').keydown(function(event){
if (event.which == 13) {
$.ajax({
url: 'ajax.php',
type: 'POST',
data: 'cBar=' + $(this).val(),
success: function(data){
$('#resultado').html(data);
}
});
event.preventDefault();
}
});
})
<!-- <table id="latabla"></table>
<input type="button" id="mostrar" value="Mstra"/>-->
<input id="enviar" name="enviar" type="submit" value="Aceptar" />
pagina2:
Código PHP:
Ver original<?php
header("Content-Type: text/html;charset=utf-8"); /* al rellenar el codigo de barras se nos muestra la informacion del producto
* http://www.forosdelweb.com/f13/ajax-php-conectada-con-resultados-base-datos-1015007/
*/
include_once 'clases/Class_Bd.php';
echo " <link rel='stylesheet' type='text/css' media='screen' href='cssPageGrid.css' />";
$conexion = new Conecta_DB;
$conexion->conectar();
$res = $_POST['cBar'];
//$res2=123;
//echo "la variable es :".$res;
$consulta = "SELECT cBarras,nombre,descripcion,familiaArt FROM altaArticulos WHERE cBarras='$res' limit 1";
$query = $conexion->consultar($consulta);
//print_r($query);
/*
while ($row = mysql_fetch_assoc($query)) {
$aviso0 = $row['nombre'];
$aviso1 = $row['descripcion'];
$aviso2 = $row['familia'];
$aviso = "Articulo " . $aviso0 . "con la descripción " . $aviso1 . "que pertenece a la familia " . $aviso2 . ".";
print "<textarea id='resultado'>" . $aviso . "</textarea>";
}*/
foreach($query as $row){
$aviso0 = $row['nombre'];
$aviso1 = $row['descripcion'];
$aviso2 = $row['familiaArt'];
$aviso = "Articulo: " . $aviso0 . ", con la descripción: " . $aviso1 . ", que pertenece a la familia: " . $aviso2 . ".";
echo "<textarea id='resultado'>" . $aviso . "</textarea>";
}
/* while ($row = mysql_fetch_array($query,MYSQL_NUM)) {
$aviso0 = $row[0];
$aviso1 = $row[1];
$aviso2 = $row[2];
$aviso = "Articulo " . $aviso0 . "con la descripción " . $aviso1 . "que pertenece a la familia " . $aviso2 . ".";
print "<textarea id='resultado'>" . $aviso . "</textarea>";
}
}*/
?>