demo.html
<html>
<title> Employee
detail form </title>
<body>
<h1
style="text-align:center; color:Orange";>Employee
Details</h1>
<h2
style="text-align:center; color:green";>Using Radio Buttons, Check
box and Drop down list </h2>
<form
method="POST" action="employee1.php"></br>
<fieldset
style="background-color:Pink;">
First Name :
<input type="text" name="fname" ></br>
Last Name : <input type="text"
name="lname" ></br>
Address : <textarea name="addr"
rows="4" cols="30"></textarea></br>
Salary : <input type="number"
name="salary"></br>
</fieldset><br>
<fieldset>
Skills
:<br> <input type
="checkbox" name="check_list[]"
value="C">C<br>
<input type
="checkbox" name="check_list[]" value="C++">
C++</br>
<input type
="checkbox" name="check_list[]"
value="PHP">PHP</br>
<input type
="checkbox" name="check_list[]"
value="Python">Python</br>
<input type
="checkbox" name="check_list[]"
value="VB">VB</br>
</fieldset><br>
<fieldset>
Gender : <br>
<input type ="radio" name="gender"
value="Male" checked>Male
<input type ="radio"
name="gender" value="Female">Female <br>
</fieldset><br>
<fieldset>
Qualification :
<select name="Qualification">
<option
value="Graduate"> Graduate </option>
<option
value="Under-Graduate"> Under-Graduate </option>
<option
value="Post -Graduate"> Post-Graduate </option>
</select>
</fieldset>
<input type
="submit" name="subtn" value="Submit">
</form>
</body>
</html>
employee1.php
<?php
$fn=$_POST['fname'];
$ln=$_POST['lname'];
$ad=$_POST['addr'];
$sal=$_POST['salary'];
$skl=$_POST['check_list'];
$gen=$_POST['gender'];
$qua=$_POST['Qualification'];
$n=0;
if(isset($_POST['subtn']))
{
echo "Entered
Employee Information<br><br>";
echo "Full
Name : $fn $ln<br><br> Address : $ad<br><br> Salary :
$sal";
if($sal>=50000)
{
$n=1;
}
else if($sal>=40000
&& $sal<=49999)
{
$n=2;
}
else if($sal>=30000
&& $sal<=39999)
{
$n=3;
}
else
{
$n=4;
}
switch($n)
{
case 1:
echo"Salary is
Great!<br>";
break;
case 2:
echo"Salary is
Good<br>";
break;
case 3:
echo"Salary is
Nice!<br>";
break;
/*case 4:
echo"Please
enter Salary details";*/
default :
echo "Please
enter the Salary<br>";
}
if(!empty($_POST['check_list']))
{
$checked=count($_POST['check_list']);
echo "<br>You have selected
$checked items :<br>";
foreach($_POST['check_list'] as $sel)
{
echo"$sel <br>";
}
}
else
{
echo"<i> Please select one option
</i>";
}
if($gen=='Male')
{
echo
"<br>You are a Male<br>";
}
else
{
echo
"<br>You are a Female<br>";
}
}
?>
Output:
No comments:
Post a Comment