SIMULATION OF STATEFUL HTTP USING PHP SESSION

Step1: Execute a session for each accountant when the accountant logs in.
Step2: Create an page to enter register number and fees paid by the student.
Step3: When the accountant click submit button, retrieve the session data and add the current
           fees paid
Step4: Repeat this for every  fees collection by the accountant.
Step5: When a particular accountant logout, display the session data as total fees collection for
            that session.
Step6: Each session is destroyed whenever the accountant logout.
Step7: Execute the program in browser.
PHP CONCEPT

Session Connection
Session_start()
Storing Data
$_session[‘Amoount’]=$fee;


Reading And Updating
$amt=$_session[‘amount’];
$amt=$amt+$fee;
$_Session[‘amount’]=$amt
Deleting Session
Session_destroy();


PROGRAM
collection.php
<html><body bgcolor=violet>
<center><image src="123.jpg">
<table border="1" align="center">
<tr> <td>Roll No </td><td><input type="text" name="textfield" /></td>
</tr> <tr> <td>Amount  Rs </td> <td><input name="amt" type="text" id="amt" /></td>
</tr> <tr><td colspan="2"><div align="center"><input type="submit" name="Submit" value="Submit" />
        </div></td>        </tr>    </table></body></html>
fees.php
<?php
session_start();
$_SESSION['amt1'];
$_SESSION['amt1']=$_SESSION['amt1']+ $_POST['amt'];
$amt1=$_SESSION['amt1']; ?>
<html><center><h1><?php
echo "Today Collection: ".$amt1;
?>
</h1></center></html>
<?php
include("collection.php");
?>

0 comments: