<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DMMYSQLG.php");

?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<body>
<?php
 
$ayuda = 'DG1120A_PR.php';
include("DYAYUDA.php");
?>
<div align="center">
  <form name="form1" method="post" action="">
    <table width="458"  align="center">
      <tr>
        <th colspan="2">CATALOGO DE COLOR </th>
      </tr>
      <tr>
        <th width="297"> <input name="r1" type="radio" value="clave" tabindex="1">
        CLAVE</th>
        <th width="297"><input name="r1" type="radio" value="nombre" tabindex="2">
         DESCRIPCION</th>
      </tr>
      <tr>
        <td colspan="2"><input name="tbus" type="text" onBlur="may(this)" size="75"/></td>
      </tr>
      <tr>
        <td colspan="2"><div align="center">
          <input type="submit" name="Submit" value="Buscar" />
        </div></td>
      </tr>
    </table>
  </form>
</div>
<div align="center">
  <form name="frm1" id="frm1" method="post" action="" >
    <?php
 
	$sql = mysqli_query($con ,"SELECT * FROM fcolor order by clave");
	include("DE10000.php");
	?>
    <table width="711" border='1'>
      <tr>
        <th colspan="7"> <div align="center">
          <input type="button" name="Submit6" value="Agregar" onClick="openpage('valeryus11000_AG.php','_self')"/>
          <input type="Submit" name="bot3" value="Consultar"  onClick="openpage('valeryus11000_CO.php','_self')"/>
          <input type="button" name="bot2" value="Modificar" onClick="openpage('valeryus11000_MO.php','_self')"/>
          <input type="button" name="bot1" value="Eliminar" onClick="openpage('valeryus11000_EL.php','_self')"/>
          <input type="button" name="bot4" value="Imprimir " onClick="openpage('valeryus11000_IM.php','_self')"/>
          <input type="button" name="Submit" value="Mostrar todo" onClick="openpage('valeryus11000_PR.php','_self')"/>
        </div></th>
      </tr>
      <tr>
        <th><div align="center">SEL</div></th>
        <th><div align="center">CLAVE</div></th>
        <th><div align="center">DESCRIPCION</div></th>
				
      </tr>
      <?php

	echo '<input name="txt_bus" type="hidden" value="'.$_POST['tbus'].'">';
	if($_POST['r1']=="clave")
	{
		echo '<input name="tip_bus" type="hidden" value="clave">';
	  	@$sql = mysqli_query($con ,"SELECT * FROM fcolor WHERE clave = '".$_POST['tbus']."'");
		
	}elseif($_POST['r1']=="nombre")
	{
		echo '<input name="tip_bus" type="hidden" value="nombre">';
		@$sql = mysqli_query($con ,"SELECT * FROM fcolor WHERE descrip like '%".$_POST['tbus']."%'");
	}
	while($reg = mysqli_fetch_array($sql))
	{
	  	echo "<tr>";
		echo '<td> <div align="center" style="background-color:'.$reg["clave"].';"><input name="bot" type="radio" value="'. $reg["n_reg"].'"></div></td>';
		echo "<td> <div align='center'>" . $reg["clave"] . "&nbsp;</div></td>";
		echo "<td> <div align='left'>" . $reg["descrip"] . "&nbsp;</div></td>";
		echo "</tr>";
	}
	mysqli_close($con);
	?>
    </table>
  </form>
</div>
</body>
</html>