Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/09/2012, 22:06
MAXI279
 
Fecha de Ingreso: septiembre-2012
Mensajes: 32
Antigüedad: 11 años, 8 meses
Puntos: 0
Solucionar error notice al insertar registro en tabla bd mysql

Buenas noches, tengo el codigo siguiente que inserta datos en una tabla de base de datos , funciona bien, el unico error que no puedo encontrar, es en la linea 3, notice, unexpected index.. una variable esta libre algo asi.. no la encuentro.. El codigo funciona perfectamente y luego de insertar el primer registro el notice desaparece, pero al principio verlo es molesto, pueden echarle una leida? desde ya muchas gracias !!


<?php
$state = false;
if ($_POST['action'] == "add") {
$conexion = mysql_connect("localhost", "root", "");
mysql_select_db("test", $conexion);

$que = "INSERT INTO impresora1 (Fecha, PedidoN, RemitoN, Descripcion, Cant, Pedidoscant) ";
$que.= "VALUES ('".$_POST['Fecha']."', '".$_POST['PedidoN']."', '".$_POST['RemitoN']."', '".$_POST['Descripcion']."', '".$_POST['Cant']."', '".$_POST['Pedidoscant']."') ";
$res = mysql_query($que, $conexion) or die(mysql_error());
$state = true;
}
?>
<!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=iso-8859-1" />
<title>Insertar datos en MySQL</title>
<style type="text/css">
<!--
body {
font-family: "Trebuchet MS", Tahoma, Arial;
font-size: 12px;
color: #333333;
}
h2 {
font-size: 16px;
color: #CC0000;
}
input, select {
font-family: "Trebuchet MS", Tahoma, Arial;
font-size: 11px;
color: #666666;
}
-->
</style>
</head>
<body>
<h2>Insertar datos Impresora 1</h2>
<form id="insertar" name="insertar" method="POST" action="">
<p>Fecha:
<input name="Fecha" type="text" id="Fecha" size="50" />
</p>
<p>Pedido N°:
<input name="PedidoN" type="text" id="PedidoN" size="50" />
</p>
<p>Remito N°:
<input name="RemitoN" type="text" id="RemitoN" size="50" />
</p>
<p>Descripcion:
<input name="Descripcion" type="text" id="Descripcion" size="50" />
</p>
<p>Cantidad:
<input name="Cant" type="text" id="Cant" size="50" />
</p>
<p>Pedidos Cant:
<input name="Pedidoscant" type="text" id="Pedidoscant" size="50" />
</p>
<input type="submit" name="Submit" value= "Insertar Registro" />&nbsp;&nbsp;&nbsp;
<input type="hidden" name="action" value= "add" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="TABLA.PHP"><strong>Ver Historial de
Registros</strong></a></form>
<?php if ($state) { ?>
<p><em>Registro insertado correctamente</em></p>
<?php } ?>
</body>
</html>