<?php
	include("Test.php");
	session_start();
	if(isset($_SESSION["ingreso"]))
	{
			$codp = $_GET["codp"];
			$stmt1="SELECT cod_producto, nom_producto, pre_producto, des_producto, m_categoria_cod_categoria FROM  producto WHERE cod_producto =$codp";
			$result1=mysqli_query($link,$stmt1);
		?>
		<!DOCTYPE html>
		<html>
		<head>
			<title>Productos</title>
			<script type="text/javascript" src="script.js"></script>
			<link rel="stylesheet" type="text/css" href="css/estilo_tabla.css">
			<link rel="stylesheet" type="text/css" href="ghb/gh-buttons.css">
			<meta charset="UTF-8">
			<link rel="shortcut icon" href="img/logo_icon.ico">
		</head>
		<body link="blue" vlink="blue" alink="blue">
			<div id="wrapper"> 
          		<a href="Logout.php"><img src="img/cerrar.png" alt="Cerrar"></a>
          		<label style="padding-left:680px;"><a href="javascript:history.back(1)"><img src="img/atras.png" alt="Cerrar"></a></label>
         	</div>

         	<div id="wrapper">

				<form name="frm1" method="POST" action="Actualizar.php">
					<table id="keywords" cellspacing="0" cellpadding="0">
					<thead>
					<tr>
					<th><span>CÓDIGO</th></span>
					<th><span>NOMBRE</th></span>
					<th><span>PRECIO</th></span>
					<th><span>DESCRIPCIÓN</th></span>
					</tr>
					</thead>
					<tbody>
		<?php
					while($row1 = mysqli_fetch_array($result1)){
						echo"<tr>";
						echo"<td>". $row1["cod_producto"] ."</td>";
						echo"<td>". $row1["nom_producto"] ."</td>";
						echo"<td><input type='number' name='txt1' value='". number_format($row1["pre_producto"],2) ."' onkeypress='return valida(event)' required='required'></td>";
						echo"<td><input type='text' name='txt_descrip' value='". ($row1["des_producto"]) ."' maxlength='50' size='35' required='required'></td>";
				
						echo"<input type='hidden' name='hcode_producto' value='". $row1["cod_producto"]."' autocomplete='off'>";
						echo"<input type='hidden' name='hcode_categoria' value='". $row1["m_categoria_cod_categoria"]."' autocomplete='off'>";
						echo"</tr>";
					}
		?>
					</tbody>
					</table>
					<br><br>
					<center><input type="submit" name="btnenviar" value="Actualizar" class="button primary">&nbsp;&nbsp;&nbsp;
					<input type="button" name="btncancelar" value="Cancelar" onclick="javascript:history.back(1)" class="button danger">
					<br><br>
					</center>
				</form>

		<script src="//static.codepen.io/assets/common/stopExecutionOnTimeout-b2a7b3fe212eaa732349046d8416e00a9dec26eb7fd347590fbced3ab38af52e.js"></script>
      	<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> 
      	<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.28.14/js/jquery.tablesorter.min.js"></script>
		</body>
		</html>
		<?php
		}else{
			header("Location:index.html");
		}
?>