...

View Full Version : Session Variable



bspahr
10-20-2006, 10:59 PM
I am working on this page. I am pulling the session variable "test" from the previous page which is a number. If they enter that number on this page I want an alert to display saying that they cannot enter there on number. Can't seem to get it to work though.





<%@Language=VBScript %>

<%
test = Session("test")
%>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>

<script language="javascript">
function chkForm() {
var test = document.frmOrder.test.value;
var SessionName = document.frmOrder.SessionName.value

// Check Number
if (test.value =SessionName) {
alert('You cannot enter this number');
return false
}

}
</script>

</head>
<body>




<form name="frmOrder" method="post" action="return.asp" onSubmit="return chkForm();">
<input type="hidden" name="SessionName" value="<%=test%>">



<table bgcolor="#ffffff" border="0" width="250" cellspacing="1" cellpadding="2" class="main">
<tr>
<td bgcolor="#FFFFFF">Test:</td>
<td bgcolor="#FFFFFF"><input type="text" name="test" maxlength="5" size="5"></td>
</tr>
</table>


<input type="Submit" value="Continue" name="Continue"><br>


</body>
</html>

Philip M
10-21-2006, 08:48 AM
if (test.value ==SessionName)

bspahr
10-23-2006, 03:19 PM
Thanks, but it is still not working.

mutale
10-23-2006, 03:30 PM
try

if (test == SessionName)

bspahr
10-23-2006, 03:35 PM
That did it! Thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum