Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/05/2007, 08:26
Avatar de hulray
hulray
 
Fecha de Ingreso: septiembre-2006
Mensajes: 630
Antigüedad: 17 años, 7 meses
Puntos: 3
problema al agregar

tengo un problema, intentare explicarlo:

Al agregarme un dato me sale el siguiente error:
Warning: Cannot modify header information - headers already sent by (output started at /home/ljubetic/public_html/conec.php:16) in /home/ljubetic/public_html/agregar2_equipo.php on line 6

y al darle f5 me agrega a la base de datos. No se porque ese error, si alguien me puede ayudar.

Gracias

agregar_equipo.php

Código PHP:
<html>
<head>
   <title>Sistema de Ventas - Ljubetic</title>
   <style type="text/css">
<!--
.Estilo1 {color: #FFFFFF}
-->
   </style>
</head>
<body>
<H1>Agregar un equipo</H1>
<FORM ACTION="agregar2_equipo.php" METHOD="POST">
<TABLE>
<TR>
   <TD>Nº Interno:</TD>
   <TD><INPUT TYPE="text" NAME="ninterno" SIZE="20" MAXLENGTH="30"></TD>
</TR>
<TR>
   <TD>Equipo:</TD>
   <TD><INPUT TYPE="text" NAME="equipo" SIZE="20" MAXLENGTH="30"></TD>
</TR>
<TR>
   <TD>Marca:</TD>
   <TD><INPUT TYPE="text" NAME="marca" SIZE="20" MAXLENGTH="30"></TD>
</TR>
<TR>
   <TD>Modelo</TD>
   <TD><INPUT TYPE="text" NAME="modelo" SIZE="20" MAXLENGTH="30"></TD>
</TR>
<TR>
   <TD>N&ordm; Serie </TD>
   <TD><INPUT TYPE="text" NAME="nserie" SIZE="20" MAXLENGTH="30"></TD>
</TR><TR>
   <TD>A&ntilde;o</TD>
   <TD><INPUT TYPE="text" NAME="ano" SIZE="20" MAXLENGTH="30"></TD>
</TR><TR>
   <TD>Motor :</TD>
   <TD><INPUT TYPE="text" NAME="motor" SIZE="20" MAXLENGTH="30"></TD>
</TR><TR>
   <TD>Modelo Motor: </TD>
   <TD><INPUT TYPE="text" NAME="modelo_motor" SIZE="20" MAXLENGTH="30"></TD>
</TR><TR>
   <TD>Serie Motor </TD>
   <TD><INPUT TYPE="text" NAME="serie_motor" SIZE="20" MAXLENGTH="30"></TD>
</TR>
<TR>
   <TD>Capacidad:</TD>
   <TD><INPUT TYPE="text" NAME="capacidad" SIZE="20" MAXLENGTH="30"></TD>
</TR>
</TABLE>
<INPUT TYPE="submit" NAME="accion" VALUE="Grabar">
</FORM>
<hr>
<?php
   
include("conec.php");
   
$link=Conectarse();
   
$result=mysql_query("select * from equipos",$link);
?>
 <TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1>
      <TR>
         <TD bgcolor="#000000"><span class="Estilo1">&nbsp;NºInterno</span></TD>
         <TD bgcolor="#000000"><span class="Estilo1">&nbsp;Equipo&nbsp;</span></TD>
         <TD bgcolor="#000000"><span class="Estilo1">&nbsp;Marca&nbsp;</span></TD>
         <TD bgcolor="#000000"><span class="Estilo1">&nbsp;Modelo&nbsp;</span></TD>
         <TD bgcolor="#000000"><span class="Estilo1">&nbsp;Nº Serie&nbsp;</span></TD>
         <TD bgcolor="#000000"><span class="Estilo1">&nbsp;Año&nbsp;</span></TD>
         <TD bgcolor="#000000"><span class="Estilo1">&nbsp;Motor&nbsp;</span></TD>
         <TD bgcolor="#000000"><span class="Estilo1">&nbsp;Modelo Motor&nbsp;</span></TD>
         <TD bgcolor="#000000"><span class="Estilo1">&nbsp;Serie Motor&nbsp;</span></TD>
         <TD bgcolor="#000000"><span class="Estilo1">&nbsp;Capacidad&nbsp;</span></TD>
   </TR>
<?php      
   
while($row mysql_fetch_array($result)) {
printf("<tr><td> &nbsp;%s </td><td> &nbsp;%s&nbsp; </td><td> &nbsp;%s&nbsp; </td><td> &nbsp;%s&nbsp; </td><td> &nbsp;%s&nbsp; </td><td> &nbsp;%s&nbsp; </td><td> &nbsp;%s&nbsp; </td><td> &nbsp;%s&nbsp; </td><td> &nbsp;%s&nbsp; </td><td> &nbsp; <imgsrc=%s> &nbsp; </td></tr>"$row["ninterno"], $row["equipo"], $row["marca"], $row["modelo"], $row["nserie"], $row["ano"], $row["motor"], $row["modelo_motor"], $row["serie_motor"], $row["capacidad"]);
   }
   
mysql_free_result($result);
?>
</table>
</body>
</html>
Agregar equipo2.php
Código PHP:
<?php
   
include("conec.php");
   
$link=Conectarse();
$Sql="insert into equipos (ninterno,equipo,marca,modelo,nserie,ano,motor,modelo_motor,serie_motor,capacidad)  values ('".$_POST["ninterno"]."','".$_POST["equipo"]."', '".$_POST["marca"]."', '".$_POST["modelo"]."', '".$_POST["nserie"]."', '".$_POST["ano"]."', '".$_POST["motor"]."', '".$_POST["modelo_motor"]."', '".$_POST["serie_motor"]."', '".$_POST["capacidad"]."')";      
   
mysql_query($Sql,$link); 
   
header("Location: agregar_equipo.php");
?>

Última edición por hulray; 17/05/2007 a las 08:36