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º Serie </TD>
<TD><INPUT TYPE="text" NAME="nserie" SIZE="20" MAXLENGTH="30"></TD>
</TR><TR>
<TD>Añ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"> NºInterno</span></TD>
<TD bgcolor="#000000"><span class="Estilo1"> Equipo </span></TD>
<TD bgcolor="#000000"><span class="Estilo1"> Marca </span></TD>
<TD bgcolor="#000000"><span class="Estilo1"> Modelo </span></TD>
<TD bgcolor="#000000"><span class="Estilo1"> Nº Serie </span></TD>
<TD bgcolor="#000000"><span class="Estilo1"> Año </span></TD>
<TD bgcolor="#000000"><span class="Estilo1"> Motor </span></TD>
<TD bgcolor="#000000"><span class="Estilo1"> Modelo Motor </span></TD>
<TD bgcolor="#000000"><span class="Estilo1"> Serie Motor </span></TD>
<TD bgcolor="#000000"><span class="Estilo1"> Capacidad </span></TD>
</TR>
<?php
while($row = mysql_fetch_array($result)) {
printf("<tr><td> %s </td><td> %s </td><td> %s </td><td> %s </td><td> %s </td><td> %s </td><td> %s </td><td> %s </td><td> %s </td><td> <imgsrc=%s> </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>
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");
?>