troubleshooting Question

Session Variable won't stay in page that it is passed to after pressing submit

Avatar of James Coats
James CoatsFlag for United States of America asked on
Programming
12 Comments1 Solution321 ViewsLast Modified:
The code below belongs to a form with which I want to pass a session variable with to the next page. The session variable gets passed but once the second page does a submit to the database the driver name “txtDriverName” disappears from the form and I want it to stay in that form until that user logs out. I could swear that yesterday it did do this. Now it doesn’t appear to be doing so,any suggestions??




</head>

<body>
<form method="POST" action="insertPDA.asp" name="form1">
  <table align="left">
    <tr valign="baseline">
      <td nowrap align="right"><div align="left"><strong>Name:</strong></div></td>
      <td>
        <input name="txtDriverName" type="text" id="txtDriverName" value="" size="32">
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right"><div align="left"><strong>Shift:</strong></div></td>
      <td>
<select name="shift">
  <%
While (NOT rs_shift.EOF)
%>
  <option value="<%=(rs_shift.Fields.Item("shift_letter").Value)%>"><%=(rs_shift.Fields.Item("shift_letter").Value)%></option>
  <%
  rs_shift.MoveNext()
Wend
If (rs_shift.CursorType > 0) Then
  rs_shift.MoveFirst
Else
  rs_shift.Requery
End If
%>
        </select>        
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right"><div align="left"><strong>Date:</strong></div></td>
      <td>
        <input type="text" name="start_time" value="<%response.write( now())%>" size="32">
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right"><div align="left"></div></td>
      <td>
        <input type="submit" value="Insert record">
      </td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="form1">
</form>



This is the relevant section of the second page:

Header Section:




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%session("sessDriverName")=Request.Form("txtDriverName")%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>



Relevant section of form:




      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right"><div align="left"><strong>Driver:</strong></div></td>
      <td>
        <input name="raw_matDriver" type="text" value="<%= Session("sessDriverName") %>" readonly="" size="32">
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right"><div align="left"></div></td>
      <td>
        <input type="submit" value="Insert record" name="Insert" onClick="return confirm('Are you sure you would like to insert this record?')">
      </td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="form1">
</form>

ASKER CERTIFIED SOLUTION
Christopher Kile
Senior Software Analyst

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros