Friday, January 10, 2014

PHP USer Front Page


PHP code of user front page after login


<?php
include 'settings.php';
?>
<html>
<head>
<title></title>
<style type="text/css">


#container
{

background: scroll;
background-color: #cccfff;
border: 2;

}



#container1
{
position: relative;
width: 500px;
margin: 0px auto;
height: auto;

background-color: #ff0000;
border: 1px solid #666;
padding: 15px;

}

#container2
{

position: absolute;
width: auto;
margin: 5px;
height: auto;

text-align: center;
outline-width: 5px;
background-color:#aaafff;
border: 2;
padding: 2px;



}


</style>
</head>
<div id='container' class='1'>
<body>
<div id='container1'>
<?php
$user = $_SESSION['user'];
 ?>
<h1>Welcome to Login system, <?php echo $user['username']; ?> </h1>
<ul>
<li>Email: <?php echo $user['email']; ?></li>
</ul>
</div>

<img src="P2180637.JPG" width= "10%" height="20%"/>

<div id='container2' class='o'>
<form action = '' method = 'post' name=''>
Name:  <input type = 'text' name = 'name' ><br>
Father Name:  <input type = 'text' name = 'fname' ><br>
Email:  <input type = 'text' name = 'email' ><br>
                 Date of Birth:  <input type = 'text' name = 'dob' ><br>
 current class:  <input type = 'text' name = 'currentclass' ><br>
   obtained marks:  <input type = 'text' name = 'obmarks' ><br>
                   Percentage:  <input type = 'text' name = 'percentage' ><br>
Field of study: <input type = 'text' name = 'fieldofstudy' ><br>





<input type='submit' value= 'submit' name = 'submit'>

              </form>
<div>
<?php
if(isset($_POST['registration']))
{

$name = $_POST['name'];
$fname = $_POST['fname'];
$email = $_POST['email'];
$dob= $_POST['dob'];
$currentclass = $_POST['currentclass'];
$obmarks= $_POST['obmarks'];
$percentage = $_POST['percentage'];
$fieldofstudy= $_POST['fieldofstudy'];




if(!$name || !$fname || !$email || !$dob || !$currentclass || !$obmarks || !$percentage || !$fieldofstudy)
echo "Please enter all the values to Register";
else
{
$sql = "INSERT INTO registratin VALUES ( '$name','$fname','$email' , '$dob' , '$currentclass' , 'obmarks' , 'percentage' , 'fieldofstudy')";
$query = mysql_query($sql);
if($query)
echo "Registered successfully";
else
echo "Failed. There was an error while registering you.";
}
}
?>
</div>

</div>


</body>
</html>

0 comments:

Post a Comment