hi friends....the below script works in a funny manner:
it doesnt echo the session variables it is supposed to and also doesnt do the required functionality....kindly tell me wat is wrong. all the other scripts using sessions work fine...wats the problem with this one....my head is wrecking now...plz. help
<?php
function flag_error ($fieldname, $errstr)
{
global $fields_with_errors, $errors;
$fields_with_errors[$fieldname] = 1;
$errors[] = $errstr;
}
function has_error ($fieldname)
{
global $fields_with_errors;
if (isset ($fields_with_errors[$fieldname]))
return true;
return false;
}
session_start();
header("Cache-control: private");
echo$_SESSION['$var'];echo$_SESSION['$pass'];///[COLOR=Sienna]doesnot echo these variables[/COLOR]
?>
<html>
<head>
<title>Sign Up Today!</title>
<style type="text/css">
* { font-family: sans-serif }
*.error { font-size: smaller;
font-weight: bold;
color: red; }
</style>
<style type="text/css">@import url("C:\Program Files\Apache Group\Apache2\htdocs\jscalendar-1.0\calendar-blue2.css");</style>
<script type="text/javascript" src="C:\Program Files\Apache Group\Apache2\htdocs\jscalendar-1.0\calendar.js"></script>
<script type="text/javascript" src="C:\Program Files\Apache Group\Apache2\htdocs\jscalendar-1.0\lang\calendar-en.js"></script>
<script type="text/javascript" src="C:\Program Files\Apache Group\Apache2\htdocs\jscalendar-1.0\calendar-setup.js"></script>
</head>
<body bgcolor="#FFFFFF">
<?php
if (count ($errors) > 0)
{
?>
<p class="error">There were errors in your form. Please correct
the following errors and resubmit the form:</p>
<ul>
<?php
$n = count ($errors);
for ($i = 0; $i < $n; $i++)
print ("<li class=\"error\">" . $errors[$i] . "</li>\n");
?>
</ul>
<?php
}
echo$_SESSION['$var'];echo$_SESSION['$pass'];
//echo$_SESSION['']
if(($_SESSION['$var']==TRUE )&&($_SESSION['$pass']==TRUE))
{?>
<h2>teachers entry form</h2>
<hr noshade>
<small>Please fill out the classname and the date
spaces).</small>
<form action="teachers_entry_processjun4.php" method="POST" enctype="multipart/form-data" >
<table border="0">
<tr>
<td align="right">
<font size="1"><b>CLASS</b></font></td>
<td align="left"><select name='class'><option value='TYBE'>TYBE</option><option value='TYARTS'>TYARTS</option><option value='TYBCOM'>TYBCOM</option><option value='TYBSC'>TYBSC</option><option value='SYBSC'>SYBSC</option></select>
<?php if (has_error ('class')) print ('<span class="error">
*</span>'); ?></td>
</tr>
<tr>
<td align="right">
<font size="1"><b>DATE</b></font></td>
<td align="left">
<input type="text" size="6" id="data1" name="data2" />
<button id="trigger">click</button>
</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submit" value="Submit" /></td>
</tr>
</table>
</form>
<script type="text/javascript">
Calendar.setup(
{
inputField : "data1", // ID of the input field
ifFormat : "%m-%d-%Y", // the date format
button : "trigger" // ID of the button
}
);
</script><?php } else{include"tchrs_login.php";}?>
</body>
</html>