Hello, Im trying to learn how to develop aplications with php, I took this from a tutorial, but I get an error message. The situation is very simple. Please somebody help me out. Thanks.
Adolfo this is the error message: Warning: Cannot add header information - headers already sent by (output started at c:\apache\htdocs\adul\conex.php:2) in c:\apache\htdocs\adul\inserta.php on line 20 the files involved are these: altas.php <html> <head> <title>Altas de Afiliados</title> </head> <body> <H1>Ingrese los valores correspondientes.</H1> <FORM ACTION="inserta.php"> <TABLE> <TR> <TD>Nro. Afiliado:</TD> <TD><INPUT TYPE="text" NAME="nro_afil" SIZE="20" MAXLENGTH="30"></TD> </TR> <TR> <TD>Apellido:</TD> <TD><INPUT TYPE="text" NAME="apellido" SIZE="20" MAXLENGTH="30"></TD> </TR> <TR> <TD>Nombres:</TD> <TD><INPUT TYPE="text" NAME="nombres" SIZE="20" MAXLENGTH="30"></TD> </TR> <TR> <TD>Tipo doc.:</TD> <TD><INPUT TYPE="text" NAME="tipo_doc" SIZE="20" MAXLENGTH="30"></TD> </TR> <TR> <TD>Nro. doc.:</TD> <TD><INPUT TYPE="text" NAME="nro_doc" SIZE="20" MAXLENGTH="30"></TD> </TR> <TR> <TD>Legajo:</TD> <TD><INPUT TYPE="text" NAME="legajo" SIZE="20" MAXLENGTH="30"></TD> </TR> </TABLE> <INPUT TYPE="submit" NAME="accion" VALUE="Grabar"> </FORM> <? /* verificar si existe, si no ingresar a la base de datos, si existe mostrar mensaje de error.*/ ?> <hr> </body> </html> inserta.php <?php include("conex.php"); $link=Conectarse(); mysql_query("insert into lista2 ( nro_afil, apellido, nombres, tipo_doc, nro_doc, legajo ) values ( '$nro_afil', '$apellido', '$nombres', '$tipo_doc', '$nro_doc', '$legajo' )",$link); header("Location: altas.php"); ?> Conex.php <!--conectando lista2 en php--> <?php function Conectarse() { if(!($link=mysql_connect("localhost","root"))) { echo "Error conectando a la base de datos."; exit(); } if(!mysql_select_db("lista2",$link)) { echo "Error seleccionando la base de datos."; exit(); } return $link; } ?>