
problema con include en el index.php
Publicado por trafico10 (2 intervenciones) el 20/05/2010 00:51:18
hola amigos espero me puedan ayudar desde gracias bueno resulta que estoy realizando mi web php recien experimentando con toda mi inexperiencia del caso lo que sucede es que me sale un error y es que la variable no esta definida y mas aun en la pagina index.php cree una tabla para insertar unos includes tanto para la cabecera.php para el menu.php para el footer.php pero no entiendo hasta ahora que error e cometido si me pudieran ayudar se los agradeceria muchisimo pues como recien llevo poco tiempo con el php y quiero aprender mas me estoy volviendo loco de no poder solucionar este problema y si es posible decirme como lo solucionaron de manera explicativa un saludo y gracias.
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"> <?php include "cabecera.php";?></td>
</tr>
<tr>
<td width="14%"> <?php include "menu.php" ;?></td>
<td width="86%"><table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td align="center" class="categoria"><p>Categoria</p>
//esta variable $accion es la que me trae problema segun dice no la e
declarado pero como lo hago sorry espero me ayuden//
<?php if ($accion != ""){
$sql = mysql_query("SELECT * from categoria Where id_categoria = $id"); ?>
<form id="form1" name="form1" method="post" action="<?php echo $PHP_SELF ?>">
<table width="300" border="1" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="86">Categoria</td>
<td width="214"><label>
<input name="txt_categoria" type="text" id="txt_categoria" size="35" />
</label></td>
</tr>
<tr>
<td colspan="2" align="center"><label>
<input type="submit" name="button" id="button" value="Ok" />
</label></td>
</tr>
</table>
</form>
<?php } else {?>
<table width="99%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="89%" align="left">Categorias</td>
<td colspan="2" align="center">Acción</td>
</tr>
<?php $sql = mysql_query ("select * from categoria");
while ($columna = mysql_fetch_array($sql)){?>
<tr>
<td><?php echo $columna [categoria]?></td>
<td width="4%"><img src="../images/alterar.gif" width="16" height="16" /></td>
<td width="5%"><img src="../images/excluir.gif" width="16" height="16" /></td>
</tr>
<?php }?>
<tr>
<td colspan="3"><img src="../images/insertar.gif" width="55" height="16" align="right" /></td>
</tr>
</table>
<?php }?>
<p> </p></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" align="center" valign="top"><blockquote>
<?php include"footer.php" ;?></p>
</blockquote></td>
</tr>
</table>
Notice: Undefined variable: accion in C:\wamp\www\carro_compras\admin\categoria.php on line 32
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\carro_compras\admin\categoria.php on line 56
este seria el index donde no entiendo porque no se muestra como icono php los include cabecera.php footer.php y menu.php
bueno aca les dejo los demas csripts estoy como loco porque no puedo seguir avanzando en este tema por el problema que me da porfavor espero me puedan dar una gran ayuda .
cabecera.php
<body>
<table width="779" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5%"> </td>
<td width="32%"><img src="images/logo.jpg" width="210" height="117" /></td>
<td width="60%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="64%"> </td>
<td width="36%"><img src="images/tit.jpg" width="186" height="38" /></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%">login:</td>
<td width="69%" class="hora"><strong>data:</strong>
<?php
$dia_de_semana = array("domingo", "lunes", "martes", "miercoles", "jueves", "viernes", "sabado");
$num_dia = date('w');
$dia_extenso = $dia_de_semana[$num_dia];
echo $dia_extenso. "," .date("d/m/Y");?>
- <b>Hora:</b>
<?php echo date("H:i");?>
- <b>IP:</b>
<?php echo getenv("REMOTE_ADDR");?>
</td>
<td width="5%"> </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table></td>
<td width="3%"> </td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="images/menu1.gif" width="758" height="27" /></td>
</tr>
</table>
</body>
</html>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"> <?php include "cabecera.php";?></td>
</tr>
<tr>
<td width="14%"> <?php include "menu.php" ;?></td>
<td width="86%"><table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td align="center" class="categoria"><p>Categoria</p>
//esta variable $accion es la que me trae problema segun dice no la e
declarado pero como lo hago sorry espero me ayuden//
<?php if ($accion != ""){
$sql = mysql_query("SELECT * from categoria Where id_categoria = $id"); ?>
<form id="form1" name="form1" method="post" action="<?php echo $PHP_SELF ?>">
<table width="300" border="1" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="86">Categoria</td>
<td width="214"><label>
<input name="txt_categoria" type="text" id="txt_categoria" size="35" />
</label></td>
</tr>
<tr>
<td colspan="2" align="center"><label>
<input type="submit" name="button" id="button" value="Ok" />
</label></td>
</tr>
</table>
</form>
<?php } else {?>
<table width="99%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="89%" align="left">Categorias</td>
<td colspan="2" align="center">Acción</td>
</tr>
<?php $sql = mysql_query ("select * from categoria");
while ($columna = mysql_fetch_array($sql)){?>
<tr>
<td><?php echo $columna [categoria]?></td>
<td width="4%"><img src="../images/alterar.gif" width="16" height="16" /></td>
<td width="5%"><img src="../images/excluir.gif" width="16" height="16" /></td>
</tr>
<?php }?>
<tr>
<td colspan="3"><img src="../images/insertar.gif" width="55" height="16" align="right" /></td>
</tr>
</table>
<?php }?>
<p> </p></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" align="center" valign="top"><blockquote>
<?php include"footer.php" ;?></p>
</blockquote></td>
</tr>
</table>
Notice: Undefined variable: accion in C:\wamp\www\carro_compras\admin\categoria.php on line 32
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\carro_compras\admin\categoria.php on line 56
este seria el index donde no entiendo porque no se muestra como icono php los include cabecera.php footer.php y menu.php
bueno aca les dejo los demas csripts estoy como loco porque no puedo seguir avanzando en este tema por el problema que me da porfavor espero me puedan dar una gran ayuda .
cabecera.php
<body>
<table width="779" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5%"> </td>
<td width="32%"><img src="images/logo.jpg" width="210" height="117" /></td>
<td width="60%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="64%"> </td>
<td width="36%"><img src="images/tit.jpg" width="186" height="38" /></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%">login:</td>
<td width="69%" class="hora"><strong>data:</strong>
<?php
$dia_de_semana = array("domingo", "lunes", "martes", "miercoles", "jueves", "viernes", "sabado");
$num_dia = date('w');
$dia_extenso = $dia_de_semana[$num_dia];
echo $dia_extenso. "," .date("d/m/Y");?>
- <b>Hora:</b>
<?php echo date("H:i");?>
- <b>IP:</b>
<?php echo getenv("REMOTE_ADDR");?>
</td>
<td width="5%"> </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table></td>
<td width="3%"> </td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="images/menu1.gif" width="758" height="27" /></td>
</tr>
</table>
</body>
</html>
Valora esta pregunta


0