Te haz loguedo como sa
Warning: Cannot modify header information - headers already sent by (output started at C:\Servidor\WEB\php\sess\index.php:13) in C:\Servidor\WEB\php\sess\index.php on line 21
Pues hay 2 campos (user y pass) en el cual me logea, arriba en el warning q puse, sale:"logueado como sa", entonces quiere decir si inicio la sesion... pero mi duda es por que sale el warning..el codigo es el siguiente:
Código PHP:
<?php
session_start();
?>
<html>
<head>
<title>Sesiones</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<?php
if(isset($_POST['enviar'])){
if(empty($_POST['usuario']) || empty($_POST['password']))
echo 'Debes llenar todos los datos';
elseif(!empty($_POST['usuario']) and !empty($_POST['password'])){
$_SESSION['usuario']=$_POST['usuario'];
$_SESSION['password']=$_POST['password'];
echo 'Te haz loguedo como '.$_SESSION['usuario'];
header("location:principal.php");
}
}
?>
</td>
<td rowspan="2"><form name="login" method="post" action="index.php">
<table width="250" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>Usuario:</td>
<td><input name="usuario" type="text" id="usuario"></td>
</tr>
<tr>
<td>Password:</td>
<td><input name="password" type="password" id="password"></td>
</tr>
<tr align="center">
<td colspan="2"><input name="enviar" type="submit" id="enviar" value="Enviar"></td>
//resto del codigo//no importante