<html>
<head>

<title>Session Variables Set/Get</title>
</head>

<body bgcolor=lightyellow>
<h1>Create and Read Session Variables</h1>

<form method=post name=frm action=/~sultans/php/demo/5session/session.php> 
<fieldset style='width:390px'>
<table>
<tr><td>Enter session variable name<td> <input type=text name=varName>
<tr><td>Enter session variable value<td><input type=text name=varValue>
</table>
</fieldset>
<br>
<input type=button value="Create"    onClick="validate('add')">
<input type=button value="Delete"    onClick="validate('del')">
<input type=submit value="View All"  onClick="validate_view()">
</form>

<script>
function validate(opt) 
{
    if (document.frm.varName.value =='')
    {
        alert("Please enter session variable name")
        return false
    }
    if (opt =='add' && document.frm.varValue.value =='')
    {
        alert("Please enter session variable value")
        return false
    }
    url = '/~sultans/php/demo/5session/session.php'
    document.frm.action = url + '?option=' + opt;    //append to url?option=opt
    document.frm.submit();

}
function validate_view() 
{
    document.frm.varName.value  = '';                   //erase the variable name
    document.frm.varValue.value = '';                   //erase the variable value
}
</script>
</body>
</html>