Hello, I have this form so people can get in insert their URN and password and log in. If there is an error (after checking with database entries...not yet built) a message is displayed otherwise i want the user to be redirected on another php file. The header does not work there because it is not on the beginning and i wnat to ask if someone knows how to do it or another more flexible way
thanks
<?php
require ('main.php');
$page = new homePage();
$page -> content = '<p class = "content"> Student Log In </p> <br><br><br><br> ';
$page -> Display();
if(isset($_POST['subButton']))
{
$error_msg='';
if(trim($_POST['urn'])=='' || strlen(trim($_POST['urn'])) < 7)
{
?>
<div style = "position:absolute; top:300px; left:300">
<?
$error_msg.="Please enter your urn <br>";
?>
</div>
<?
}
if(trim($_POST['pass'])=='' || strlen(trim($_POST['pass'])) < 6)
{
$error_msg.="Please enter your password<br>";
}
if($error_msg=='')
{
header('location: ' . 'stud.php');
exit();
}
else
{
echo "<font color=red size = 4><b>$error_msg</b></font>";
}
}
?>
<form class = "myform" action="" method="POST">
<div style = "position:relative; top:0%; left:35">
<font size = "4"><b> Please insert your URN and password </b></font><br><br>
<table border="1" cellpadding="7" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="600" id="AutoNumber1">
<tr>
<td align = "right" width = "16%"> URN: </td>
<td width = "84%"><input class = "input" type = "text" name = "urn" value = "<?echo $_POST['urn'];?>" maxlength = "10"></td>
</tr>
<tr>
<td align = "right" width = "16%"> password: </td>
<td width = "84%"><input class = "input" type = "password" name = "pass" value = "<?echo $_POST['pass'];?>" maxlength = "10"></td>
</tr>
<tr>
<td colspan = "2" align = "middle"><input class = "button" type="submit" name="subButton" value=" > Log In < "></td>
</tr>
</table>
</div>
</form>
<?php
$page -> Display2();
?>