Forum Moderators: open

Message Too Old, No Replies

ASP session variable

using session variable to populate a form

         

freabird

7:45 pm on May 2, 2004 (gmt 0)

10+ Year Member



Hi there,

I have a page for users to login to a MS Access table. Upon successful login, I use the following code to create a session variable from each of the fields in the user table: (then they are redirected to a page where they can update their account)
----------------------------------------------
for each strField in rsUsers.Fields
strName = strField.Name
strValue = strField.value
Session(strName) = strValue
Next
Response.Redirect "MyAccount.asp"
----------------------------------------------
A link on the "MyAccount.asp" page brings up a page with a form that they can use to update their account. I’m trying to populate the form with the user’s data using the session variables like this. This is the form code for the StreetAddress1 field:
---------------------------------------------------
<INPUT maxLength=70 size=40 name=StreetAddress1 value=<%= Session("StreetAddress1") %> >
---------------------------------------------------
What happens is only part of the data is going into the form’s input field. The data in the table is "1650 Carson Street" but the only part that comes out is "1650" (up to the first space).

Can anyone tell me what I’m doing wrong?

Thanks!

freabird

8:15 pm on May 2, 2004 (gmt 0)

10+ Year Member



Never mind... I just figured it out. This appears to be one of those times when quotes are required like this:

<INPUT maxLength=70 size=40 name=StreetAddress1 value="<%= Session("StreetAddress1") %>" >

Thanks anyway....

mattglet

11:00 pm on May 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should put quotes around all html attributes:

<INPUT maxLength="70" size="40" name="StreetAddress1" value="<%= Session("StreetAddress1") %>" >

-Matt