Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/05/2010, 13:32
xpitutox
 
Fecha de Ingreso: mayo-2010
Ubicación: valpo_UC
Mensajes: 34
Antigüedad: 13 años, 11 meses
Puntos: 0
Ayuda Con insert

estoy haciendo un sistema de bodega en el cual tengo ke hacer ingresos de material y guardarlos en una base de datos nada del otro mundo pero tengo problemas con el insert al momento de guardar los datos me arroja el siguiente error
" Notice: Undefined index: txtcostos in C:\wamp\www\PruebasIndecs\conectar.php on line 20 "
y no me inserta los datos
index.php

Código:
<form name="form1" method="POST" action="formulario.php">
  <div align="center">
    <table width="771" height="85" border="4" align="center" bordercolor="#666666">
      <tr>
        <td><div align="center"><img src="Logo Indecs.jpg" width="732" height="73" /></div></td>
      </tr>
  </table>
    <table width="823" height="301" border="2" align="center" bordercolor="#333333">
      <tr>
        <td width="337"><strong>Centro Costos</strong></td>
        <td width="144"><div align="center">
          <input type="text" name="txtcostos" id="txtcostos" />      
        </div></td>
        <td width="250"><strong>Nombre Solicitante</strong></td>
        <td width="144"><div align="center">
          <input type="text" name="txtnombre" id="txtnombre" />
        </div></td>
      </tr>
      <tr>
        <td><strong>Nombre Trabajo</strong></td>
        <td>
          <div align="center">
            <input type="text" name="txttrabaja" id="txttrabaja" />
          </div></td>
        <td><strong>Impresion B/ N</strong><span class="Estilo3">.</span></td>
        <td><div align="center">
          <input type="text" name="txtimpresion" id="txtimpresion" />
        </div></td>
      </tr>
      <tr>
        <td><strong>Impresion Color</strong></td>
        <td>
          <div align="center">
            <input type="text" name="txtcolor" id="txtcolor" />
          </div></td>
        <td><label></label>
        <strong>Scanner</strong></td>
        <td><div align="center">
          <input type="text" name="txtscan" id="txtscan" />
        </div></td>
      </tr>
      <tr>
        <td><strong>Hoja Carta B</strong><span class="Estilo1"><span class="Estilo2">lanca</span></span></td>
        <td>
          <div align="center">
            <input type="text" name="txtcarta" id="txtcarta" />
          </div></td>
        <td><strong>Hoja Oficio Blanca</strong></td>
        <td><div align="center">
          <input type="text" name="txtoficio" id="txtoficio" />
        </div></td>
      </tr>
      <tr>
        <td><strong>Hoja Carta Amarilla</strong></td>
        <td>
          <div align="center">
            <input type="text" name="txtcamarilla" id="txtcamarilla" />
          </div></td>
        <td><strong>Hoja Oficio Amarilla</strong></td>
        <td><div align="center">
          <input type="text" name="txtoamarilla" id="txtoamarilla" />
        </div></td>
      </tr>
      <tr>
        <td><strong>Hoja Doble Carta<span class="Estilo3">..</span>Bond Blanca</strong></td>
        <td>
          <div align="center">
            <input type="text" name="txthdoblec" id="txthdoblec" />
          </div></td>
        <td><strong>Corchetes<span class="Estilo1"><span class="Estilo3">c<span class="Estilo5">4112</span> ...</span></span></strong></td>
        <td><div align="center">
          <input type="text" name="txtcorchetes" id="txtcorchetes" />
        </div></td>
      </tr>
      <tr>
        <td><strong>Opalina Oficio Blanca</strong></td>
        <td>
          <div align="center">
            <input type="text" name="txtopab" id="txtopab" />
          </div></td>
        <td><label><strong>Opalina Oficio Color</strong></label></td>
        <td><div align="center">
          <input type="text" name="txtopac" id="txtopac" />
        </div></td>
      </tr>
      <tr>
        <td><strong>Lomo Negro Carta Narrow</strong></td>
        <td>
          <div align="center">
            <input type="text" name="txtlomonc" id="txtlomonc" />
          </div></td>
        <td><strong>Lomo NegroCarta Medium</strong></td>
        <td><div align="center">
          <input type="text" name="txtlomoncm" id="txtlomoncm" />
        </div></td>
      </tr>
      <tr>
        <td height="42"><strong>Lomo Negro</strong><span class="Estilo5"> <strong>Oficio Narrow</strong></span></td>
        <td>
          <div align="center">
            <input type="text" name="txtlomono" id="txtlomono" />
          </div></td>
        <td><strong>Lomo Negro</strong><strong> Oficio Medium</strong></td>
        <td><div align="center">
          <input type="text" name="txtlomonom" id="txtlomonom" />
        </div></td>
      </tr>
      </table>
    <table width="59" border="3" align="center" bordercolor="#00FF00">
      <tr>
        <td><input type="submit" name="btnenviar" id="btnenviar" value="Enviar" />
   </td>
      </tr>
  </table>
</form>

Código:
<?php
$a1 = 15.14; //blanco y negro
$b1 = 56.79; //color
$c1 = 15.14; //Scaneo
$d1 = 10.52; //hoja oficio blanca
$e1 = 8.41;  //hoja carta blanca
$f1 = 12.62; //hoja carta amarilla
$g1 = 12.62; //hoja oficio amarilla
$h1 = 12.62; //hoja doble carta bond blanca        
$y1 = 178.77;//corchetes
$j1 = 44.17; //opalina oficio blanca
$k1 = 65.20; //opalina oficio color
$l1 = 525.59; //lomo negro carta narrow
$m1 = 675.76; //lomo negro carta medium
$n1 = 800.91; //lomo negro oficio narrow
$z1 = 1.003; //lomo negro oficio medium
?>
<title>Boleta Electronica </title><table width="771" height="85" border="4" align="center" bordercolor="#666666">
  <tr bordercolor="#000000">
    <td><div align="center"><img src="Logo Indecs.jpg" width="732" height="73" /></div></td>
  </tr>
</table>
<table width="823" height="301" border="2" align="center" bordercolor="#000000">
  <tr>
<td><?php echo '<font color=\"Red">Centro Costos :</font> '.$_REQUEST ["txtcostos"].'<br>';?></td>
       <td><?php echo '<font color=\"Red">Solicitante :</font> '.$_REQUEST ["txtnombre"].'<br>'; ?></td>
  </tr>
  <tr>
    <td><?php echo '<font color=\"Red">Nombre Trabajo :</font> ' .$_REQUEST ["txttrabaja"].'<br>';?></td>
       <td><?php echo '<font color=\"Red">Impresion B/N :</font> '.($_REQUEST["txtimpresion"]*"$a1").'<br>';?></td>
  </tr>
  <tr>
    <td><?php echo '<font color=\"Red">Impresion Color :</font> ' .($_REQUEST["txtcolor"]*"$b1").'<br>'; ?></td>
        <td><?php echo '<font color=\"Red">Sacanner :</font> '.($_REQUEST ["txtscan"]*"$c1").'<br>';  ?></td>
  </tr>
  <tr>
    <td><?php echo '<font color=\"Red">Hoja Oficio Blanca :</font> '.($_REQUEST ["txtoficio"]*"$d1").'<br>'; ?></td>
       <td><?php echo '<font color=\"Red">Hoja Carta Blanca :</font> '.($_REQUEST ["txtcarta"]*"$e1").'<br>'; ?></td>
  </tr>
  <tr>
    <td><?php echo '<font color=\"Red">Hoja Carta Amarilla :</font> '.($_REQUEST ["txtcamarilla"]*"$f1").'<br>'; ?></td>
       <td><?php echo '<font color=\"Red">Hoja Carta Amarilla :</font> '.($_REQUEST ["txtoamarilla"]*"$f1").'<br>'; ?></td>
  </tr>
  <tr>
    <td><?php echo '<font color=\"Red">Hoja Doble Carta Bound Blanca :</font> '.($_REQUEST ["txthdoblec"]*"$h1").'<br>'; ?></td>
       <td><?php echo '<font color=\"Red">Corchetes :</font> '.($_REQUEST ["txtcorchetes"]*"$y1").'<br>'; ?></td>
  </tr>
  <tr>
    <td><?php echo '<font color=\"Red">Opalina Oficio Blanca :</font> ' .($_REQUEST ["txtopab"]*"$j1").'<br>'; ?></td>
       <td><?php echo '<font color=\"Red">Opalina Oficio Color :</font> '.($_REQUEST ["txtopac"]*"$k1").'<br>'; ?></td>
  </tr>
  <tr>
    <td><?php echo '<font color=\"Red">Lomo Negro Carta Narrow :</font> '.($_REQUEST ["txtlomonc"]*"$l1").'<br>'; ?></td>
       <td><?php echo '<font color=\"Red">Lomo Negro Carta Medium :</font> '.($_REQUEST ["txtlomoncm"]*"$m1").'<br>'; ?></td>
  <tr>
    <td><?php echo '<font color=\"Red">Lomo Negro Oficio Narrow :</font> '.($_REQUEST ["txtlomono"]*"$n1").'<br>'; ?></td> 
        <td><?php echo '<font color=\"Red">Lomo Negro Oficio Medium :</font> '.			($_REQUEST ["txtlomonom"]*"$z1").'<br>'; ?></td>

</table>
<table width="316" height="45" border="2" align="center">
  <tr>
    <td><div align="center"><?php echo '<a href="index.php"> <--- VOLVER</a>'; ?></div></td>
    <td><div align="center"><?php echo '<a href="conectar.php">VALIDAR DATOS ---> </a>'; ?></div></td>
  </tr>
</table> 
<p align="center"></p>
<p align="center"></p>
y si estan todos los datos confirmados por el usuario hay un link ke dice validar datos y aki es donde tengo el String de conexion (ke si funciona) y donde tengo el codigo INSERT ke no funciona como corresponde porfavor si me pueden ayudar

Código:
 <?php 
mysql_connect('localhost','root','')
or die ('no se puede conectar a base de datos'.mysql_error());
mysql_select_db('indecs')or die ('no se pudo seleccionar la base de datos'.mysql_error());

$sql="INSERT INTO servicios (centro_costos, nombre_solicitante, nombre_trabajo, impresion, impresion_color, scanner, hoja_oficio_blanca, hoja_carta_blanca, hoja_carta_amarilla, hoja_oficio_amarilla, hoja_doble_carta_bond_blanca, corchetes, opalina_oficio_blanca, opalina_oficio_color, lomo_negro_carta_narrow, lomo_negro_carta_medium, lomo_negro_oficio_narrow, lomo_negro_oficio_medium )

VALUES
('$_REQUEST[txtcostos]','$_POST[txtnombre]','$_POST[txttrabaja]','$_POST[txtimpresion]','$_POST[txtcolor]','$_POST[txtscan]','$_POST[txtcarta]','$_POST[txtoficio]','
$_POST[txtcamarilla]','$_POST[txthdoblec]','$_POST[txtcorchetes]','$_POST[txtopab]','$_POST[txtopab]','$_POST[txtlomonc]','$_POST[txtlomoncm]','$_POST[txtlomono]','
$_POST[txtlomonom])";
if (!mysql_query($sql))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";
mysql_close()
?>