<html>
<body>
<form action="Q2.php" method='get'>
<table>
<tr>
<td>Enter Your Roll No. </td><td><input type=text name=roll_no placeholder="ex. 112001"><input type=Submit value="Submit"></td>
</tr>
<tr>
<td></td><td><font color="red" size="2">format of Roll No: first two digits is 11 for B.sc., 12 for Bcom, 13 for BA<br>third digit 1/2/3 for respective year<br>last three are for actual roll no.</font>
<br>
</table>
</form>
</body>
</html>
Php file -
<?php
$roll_no=$_GET['roll_no'];
echo "Your Roll Number Is :$roll_no
";
$fac=substr($roll_no,0,2);
if($fac==11
echo "Faculty is B.Sc
";
else if($fac==12)
echo "Faculty is Bcom
";
else if($fac==13)
echo "Faculty is BA
";
$year=substr($roll_no,2,1);
if($year==1)
echo "Year is First Year
";
else if($year==2)
echo "Year is Second Year
";
else if($year==3)
echo "Year is Third Year
";
echo "Your Roll No. is".substr($roll_no,3)."
";