<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.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 = 'DX2400A_PR.php';
include("DYAYUDA.php");
?>
<div align="center">
  <form name="form1" id="form1" method="post" action="">
    <table width="458"  align="center">
      <tr>
			<th colspan="2">CATALOGO DE COLONIAS </th>
      </tr>
      <tr>
        <th width="297">ESTADO</th>
        <th width="297">DELEGACION O MUNICIPIO </th>
      </tr>
      <tr>
        <td><div align="center">
          <select name="estados" onChange="javascript: document.getElementById('form1').submit()">
            <option>---------------Selecciona---------------</option>
            <?php

	@$res=mysqli_query($con ,"select * from dxestado where cve_pais='1'");
	while(@$reg=mysqli_fetch_array($res)){
		if($_POST['estados'] == $reg['cve_estado']){
			echo '<option value="' . $reg['cve_estado'] . '" selected>' . $reg['des_estado'] . '</option>';
		}else{
			echo '<option value="' . $reg['cve_estado'] . '">' . $reg['des_estado'] . '</option>';
		}
	}

?>
          </select>
        </div></td>
        <td><select name="mun" onChange="javascript: document.getElementById('form1').submit()">
          <option>---------------Selecciona---------------</option>
          <?php

if(isset($_POST['estados'])){ 
	@$res=mysqli_query($con ,"select * from dxdelmun where cve_estado='".$_POST['estados']."'");
	while(@$reg=mysqli_fetch_array($res)){
		if($_POST['mun'] == $reg['cve_delmun']){
			echo '<option value="' . $reg['cve_delmun'] . '" selected>' . $reg['des_delmun'] . '</option>';
		}else{
			echo '<option value="' . $reg['cve_delmun'] . '">' . $reg['des_delmun'] . '</option>';
		}
	}
}

?>
        </select></td>
      </tr>
    </table>
  </form>
</div>
<div align="center">
  <form name="frm1" id="frm1" method="post" action="" >
    <table width="663" border='1'>
      <tr>
        <th colspan="7"> <div align="left">
          <input type="button" name="Submit6" value="Agregar" onClick="openpage('DX24000_AG.php','_self')"/>
          <input type="Submit" name="bot3" value="Consultar"  onClick="openpage('DX24000_CO.php','_self')"/>
          <input type="button" name="bot2" value="Modificar" onClick="openpage('DX24000_MO.php','_self')"/>
          <input type="button" name="bot1" value="Eliminar" onClick="openpage('DX24000_EL.php','_self')"/>
          <input type="button" name="bot4" value="Imprimir " onClick="openpage('DX24000_IM.php','_self')"/>
        </div></th>
      </tr>
      <tr>
        <th colspan="7">Concepto de Colonias</th>
      </tr>
      <tr>
        <th width="28"><div align="center">Sel</div></th>
		<th width="121"><div align="center">Codigo Postal </div></th>
        <th width="128"><div align="center">Estado</div></th>
		<th width="155"><div align="center"> Municipio</div></th>
        <th width="197"><div align="center">Descripcion Colonia</div></th>
      </tr>
      <?php

	if(isset($_POST['estados'])){
		echo '<input name="txt_bus" type="hidden" value="'.$_POST['estados'].'">';
		echo '<input name="tip_bus" type="hidden" value="'.$_POST['mun'].'">';
		@$sql = mysqli_query($con ,"SELECT * FROM dxcoloni WHERE cve_pais = '1' and cve_estado = '".$_POST['estados']."' and cve_delmun = '".$_POST['mun']."'");
			
		
		while(@$reg = mysqli_fetch_array($sql)){
			echo "<tr>";
			echo '<td> <div align="center"><input name="bot" type="radio" value="'. $reg["cve_col"].'"></div></td>';
			echo "<td> <div align='center'>" . $reg["cod_pos"] . "</div></td>";
			@$bus=mysqli_query($con ,"select * from dxestado where cve_estado = '".$reg['cve_estado']."'");
			@$re = mysqli_fetch_array($bus);
			echo "<td> <div align='left'>" . $re['des_estado'] . "</div></td>";
			@$bus=mysqli_query($con ,"select * from dxdelmun where cve_delmun= '".$reg['cve_delmun']."'");
			@$re = mysqli_fetch_array($bus);
			echo "<td> <div align='left'>" . $re['des_delmun'] . "</div></td>";
			echo "<td> <div align='left'>" . $reg["des_colonia"] . "</div></td>";
			echo "</tr>";
		}
	}
	mysqli_close($con);
	?>
    </table>
  </form>
</div>
</body>
</html>

