Small login form using PHP


Today I learnt to small form using PHP .

I studied some concept of $_GET , $_POST , $_REQUEST method

and done a small problem with that example 🙂

This is HTML form . which will send request to form.php

form_one.html


<html>
<head>
<title>Submit your form</title>
<h1>LOGIN</h1>
</head>
<body>
<form action = "form.php" method = "post">
Name : <input type = "text" name = "uname"></br></br>
Password : <input type = "password" name = "password" ></br></br>
<input type = "submit" value = "button">
</form>
</body>
</html>

form.php


<html>
<?php
$user =  $_REQUEST['uname'];
$pass =   $_REQUEST['password'];
//echo $pass;

if ($user == "sathia" && $pass == "sathia") {
echo "<h1><font color = 'red'>Welcome ".$user."</font></h1>";
echo "Hello admin";
}
else {
 echo "<h1><font color = 'red'>You are Guest!!</font></h1>";
 echo "<p>welcome ,you are guest please register</p>";
}

?>
</html>

Advertisements

About sathia

Web developer at cloudmint
This entry was posted in Web. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s