Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/03/2013, 12:58
AxacrosS
 
Fecha de Ingreso: marzo-2013
Mensajes: 38
Antigüedad: 12 años
Puntos: 0
Problema al insertar en esta tabla

De nuevo vengo a molestarlos !!!

Bueno tengo el siguiente codigo y al ingresar no puedo ingresar me dice que las variables 14 y 15 no estan definidas :S y supongo que esta bien:

Código PHP:

<?php
include ("Conexion.php");

if (isset(
$_GET["eli"])){ 
    
$eliminar="delete from bodega where bode_cod='$_GET[eli]'";
    
$sentencia=mysql_query($eliminar,$con); 
    if (!
$sentencia){
        die (
"No elimino el registro, posible error");
        }
}

if(isset(
$_POST["btnsave"])){

    
$p=$_POST["txtcod"];
    
$m=$_POST["txtdes"];
    
$insertar="insert into bodega values('$p','$m')";

    
$sentencia=mysql_query($insertar,$con); 
    if(!
$sentencia){
        die(
"No se pudo Insertar, Existe un Error");
    }
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bodega</title>
</head>
<body bgcolor="#003399">
<h1 align="center"><b><i><Font color="#FF6600">INGRESO DE BODEGAS</Font></i></b></h1>
<p align="center">&nbsp;</p>
<div align="center">
  <table width="239" border="1">
    <tr>
      <td colspan="2"><div align="center"><font color="#FFFFFF"><b>REGISTRO DE BODEGAS</b></font></div>        
      <div align="center"></div></td>
    </tr>
    <tr>
      <td width="92"><div align="center"><B><FONT color="#FFFFFF">CODIGO</FONT></B></div></td>
      <td width="131"><div align="center">
        <form id="form1" name="form1" method="post" action="">
          <label for="textfield"></label>
          <input type="text" name="txtcod" id="txtcod" />
        </form>
      </div></td>
    </tr>
    <tr>
      <td><div align="center"><B><font color="#FFFFFF">DESCRIPCION</font></B></div></td>
      <td><div align="center">
        <form id="form2" name="form2" method="post" action="">
          <label for="textfield2"></label>
          <input type="text" name="txtdes" id="txtdes" />
        </form>
      </div></td>
    </tr>
    <tr>
      <td height="23" colspan="2"><div align="center">
        <form id="form3" name="form3" method="post" action="">
          <input type="submit" name="btnsave" id="btnsave" value="Guardar" />
          <input type="submit" name="btnmostrar" id="btnmostrar" value="Mostrar" />
          <input type="submit" name="btnedit" id="btnedit" value="Modificar" />
        </form>
      </div>        <div align="center"></div></td>
    </tr>
  </table>
</div>
<p align="center"><a href="MenuUsuario.php"><i><font color="#FFFF00">VOLVER</font></i></a></p>
<div align="center">
  <table width="434" border="1">
    <tr>
      <td><div align="center"><b>CODIGO</b></div></td>
      <td><div align="center"><b>DESCRIPCION</b></div></td>
      <td><div align="center"><b>ELIMINAR</b></div></td>
    </tr>
    <tr>
        <?php
    $listado 
"select * from bodega";
    
$sentencia mysql_query($listado,$con);
    while(
$rs=mysql_fetch_array($sentencia,$db)){ 
    
?>
    <tr>
      <td><pre><?php echo $rs["bode_cod"];?></pre></td>
      <td><pre><?php echo $rs["bode_des"];?></pre></td>
      <td> <a href="Bodega.php?eli=<?php echo $rs["bode_cod"];?>">Aqui</a></td><br>
      <?php 
    
}
      
?>
    </tr>
  </table>
</div>
<p>&nbsp;</p>
</body>
</html>
Espero sus ayudas ..
Saludos y Gracias.