//Login.php
<?php
session_start();
if(isset($_POST['s1']))
{
$x=$_POST['t1'];
$_SESSION['user']=$x;
$y=$_POST['t2'];
if(isset($_SESSION['user']))
{
header("Location:session1.php");
}
else
{
echo "Sorry........";
}
}
?>
<form id="form1" name="form1" method="post" action="">
<table width="300" border="1">
<tr>
<td width="88">User</td>
<td width="196"><input name="t1" type="text" id="t1" /></td>
</tr>
<tr>
<td>Password</td>
<td><input name="t2" type="text" id="t2" /></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input name="s1" type="submit" id="s1" value="Submit" />
</div> <div align="center"></div></td>
</tr>
</table>
</form>
//Session.php
<?php
session_start();
if(isset($_SESSION['user']))
{
echo "Hi " .$_SESSION['user'];
}
?>
<?php
session_start();
if(isset($_POST['s1']))
{
$x=$_POST['t1'];
$_SESSION['user']=$x;
$y=$_POST['t2'];
if(isset($_SESSION['user']))
{
header("Location:session1.php");
}
else
{
echo "Sorry........";
}
}
?>
<form id="form1" name="form1" method="post" action="">
<table width="300" border="1">
<tr>
<td width="88">User</td>
<td width="196"><input name="t1" type="text" id="t1" /></td>
</tr>
<tr>
<td>Password</td>
<td><input name="t2" type="text" id="t2" /></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input name="s1" type="submit" id="s1" value="Submit" />
</div> <div align="center"></div></td>
</tr>
</table>
</form>
//Session.php
<?php
session_start();
if(isset($_SESSION['user']))
{
echo "Hi " .$_SESSION['user'];
}
?>
No comments:
Post a Comment