<?php
// If the name field is filled in
if (isset($_GET['name']))
{
$userpasswords = array("shashi" => "shashi111", "srija" => "srija111", "abcde" => "abcde111");
$name = $_GET['name'];
$password = $_GET['password'];
$department = $_GET['department'];
if($userpasswords["shashi"] == $password){
printf("Hi %s! <br />", $name);
echo "You are assigned to $department";
}else{
echo "Wrong username or password";
}
}
?>
<form action="login.php" method="get">
<p>
Name:<br />
<input type="text" id="name" name="name" size="20" maxlength="40" />
</p>
<p>
Password Field:<br />
<input type="password" id="password" name="password" size="20" maxlength="40" />
</p>
<p>
Department:<br />
<select name="department">
<option value="cs">MSc Computer Science</option>
<option value="bca">Bachelor in Computer Applications</option>
<option value="bit">BSc IT</option>
</select>
<input type="submit" id="submit" name = "submit" value="Go!" />
</form>
Categories:
PHP