o algo del insert estara mal? ... el Delete me lo imprime bien mas el insert no me lo imprime e ahi el problema ... tendre que declarar variables .. sera acaso eso?'
este es todo mi codigo en el archivo...algo a de tar mal pero la neta no encuentro que es .. :S:S:S porfass !!
Código PHP:
Ver original<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Accesos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styles/estilo1.css" rel="stylesheet" type="text/css">
<link href="styles/estilo2.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Estilo1 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
</head>
<body>
<?
require_once("conectar.php");
$link=conectar();
if(isset($_POST[btn_registrar
])){ $sl_usuario = $_POST['sl_usuario'];
$ids = $_POST['ids'];
$sqlDelete="delete from accesos where id_usuario='$_POST[sl_usuario]'";
echo "$sqlDelete";
for($i=1;$i<=$h_contador;$i++){
$ids="ch_".$i;
if($$ids){
//echo $ids."<br>";
$sql="insert into accesos set
id_usuario='$_POST[sl_usuario]',
id_modulo='".$$ids."'";
echo "<br>$sql<br>";
}
}
}
?>
<a href="login_success.php"><img src="menu.jpg" width="126" height="30" border="0"></a>
<form name="form1" method="post" action="">
<p> </p>
<div align="center"></div>
<table width="400" height="23" border="0" align="center">
<tr>
<td bgcolor="#146389"><div align="center" class="Estilo1">ACCESOS</div></td>
</tr>
</table>
<table width="400" height="23" border="0" align="center">
<tr class="tables">
<td width="114"><div align="right"><strong>Empleado:</strong></div></td>
<td width="326" rowspan="2"><div align="center">
<select name="sl_usuario" class="tables" id="select8"onChange="document.form1.submit()">
<option value="0" <? if ($_POST[sl_usuario]==0) echo "selected";?>>Seleccionar</option>
<? $sqlc="Select id,concat(nombre,' ',ape_pat,' ',ape_mat) as nom
from usuarios
order by nom";
//echo $sqlc;
//echo "<br>".mysql_num_rows($resc);
?>
<option value="<?=$rowc->id?>" <? if($_POST[sl_usuario]==$rowc->id) echo "selected";?> >
<?=$rowc->nom?>
</option>
<? } ?>
</select>
</div></td>
</tr>
<tr class="tables">
<td><?
$sql="select modulos.descripcion,modulos.id as menu,modulos.imagen,
(select id_usuario from accesos where id_usuario=$_POST[sl_usuario] and id_modulo=modulos.id) as acceso
from modulos
inner join menus on modulos.id_menu=menus.id
left join accesos on modulos.id=accesos.id_modulo
group by modulos.descripcion
order by modulos.descripcion";
//echo $sql;
$con=0;
$con++;
?></td>
</tr>
</table>
<table width="400" height="23" border="0" align="center">
<tr>
<td bgcolor="#146389"><div align="center">
<blockquote>
<blockquote>
<blockquote>
<p align="left"> <img src="menu/<?=$row->imagen?>" width="32" height="32">
<input type="checkbox" name="ch_<?=$con?>" value="<?=$row->menu?>" <? if($row->acceso>0){ ?>checked<? }?>>
<?=$row->descripcion?>
</p>
</blockquote>
</blockquote>
</blockquote>
</div> </td>
<? } ?>
</tr>
<tr>
<td><div align="center" class="tables">
<input name="btn_registrar" type="submit" id="btn_registrar7" value="Registrar" <? if($_POST[sl_usuario]<=0) echo"disabled";?> style="width:130px" >
<input name="h_contador" type="hidden" id="h_contador7" value="<?=$con?>">
</div></td>
</tr>
</table>
</form>
</body>
</html>