this code:
<?php
@session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
foreach($_POST as $k => $v) {
// store as session
$_SESSION[$k] = $v;
}
}
?>
loops through each form element on your page, and creates a session variable of the same name with the value that was entered.
to use those session variables on another page, you need to note the name of the form element, and use that as the session name.
this code:
<?php @session_start(); echo((isset($_SESSION["S_teacherName"]))?$_SESSION["S_teacherName"]:"") ?>
would work if the form element where named "S_teacherName". but if the form element has a different name, you need to change that code accordingly.