TY_BCA_AWT_SLIP 7_1



7.Create a form to accept employee details like name, address and mobile number. Once the employee information is accepted, then accept LIC information like policy_no, name, premium. Display employee details and LIC details on next form.(use COOKIE)



Html file :

<html>
<body>

<form action="slip_7_Q3_1.php" method="post">
<center>
<h2>Enter Employee Details :</h2>

<table>
<tr><td>Name : </td><td><input type="text" name="name"></td><tr>
<tr><td>Address : </td><td><input type="text" name="addr"></td></tr>
<tr><td>Mobile No : </td><td><input type="text" name="mob_no"></td></tr>
<tr><td></td><td><input type="submit" value=Next></td></tr>
</table>
</center>

</form>
</body>
</html>

Php file :

slip_7_Q3_1.php

<html>
<body>

<form action="slip_7_Q3_2.php" method="post">
<center>
<h2>Enter LIC Information :</h2>

<table>
<tr><td>Policy no. : </td><td><input type="text" name="p_no"></td><tr>
<tr><td>Policy Name : </td><td><input type="text" name="p_name"></td></tr>
<tr><td>Premium : </td><td><input type="text" name="premium"></td></tr>
<tr><td></td><td><input type="submit" value=Next></td></tr>
</table>
</center>

</form>
</body>
</html>

<?php
setcookie("emp1",$_POST['name'],time()+3600);
setcookie("emp2",$_POST['addr'],time()+3600);
setcookie("emp3",$_POST['mob_no'],time()+3600);
?>

Php file :
slip_7_Q3_2.php

<?php
echo "<h3>Employee Details</h3> ";

echo "<b>Name : </b>".$_COOKIE['emp1']."<br>";
echo "<b>Address : </b>".$_COOKIE['emp2']."<br>";
echo "<b>Mobile No. : </b>".$_COOKIE['emp3']."<br>";

echo "<b>Policy no. : </b>".$_POST['p_no']."<br>";
echo "<b>Policy Name : </b>".$_POST['p_name']."<br>";
echo "<b>Premium : </b>".$_POST['premium']."<br>";
?>

No comments:

Post a Comment

Note: only a member of this blog may post a comment.