Date Session object not passing through

B

bateman

Hi, I have a rather puzzling problem, have asked the ASP experts at work with
no joy and its driving me mad! I'll explain the steps in more detail below
but the general problem is I am manually creating a datetime value in my asp
pages that I am putting in a session. Now this isn't being passed from page
to page while other session objects are. There is no reason I can see for
this happening.

The steps I am using are:

page1.asp - A form where the user selects a time from a drop down menu that
then passes a value in the form to the next page

<select name="timeselection" class="formelements" id="timeselection">
<option value="6/21/2004 12:00:00">12:00</option>
<option value="6/21/2004 12:30:00">12:30</option>
<option value="6/21/2004 13:00:00">13:00</option>
<option value="6/21/2004 13:30:00">13:30</option>
<option value="6/21/2004 14:00:00">14:00</option>
<option value="6/21/2004 14:30:00">14:30</option>
<option value="6/21/2004 15:00:00">15:00</option>
</select>

page2.asp - The page asks the user to login or register. It posts back to
itself to check the username and password is correct. If I write out
Session("timeselection") it displays perfectly

timeselection = Request.Form("timeselection")
Session("timeselection") = timeselection

If Request.Form("username") <> "" THEN
formname = Request.Form("username")
formpass = Request.Form("password")
sSQL = "SELECT tbl_user.fld_user_uid, tbl_user.fld_firstname,
tbl_user.fld_surname, tbl_user.fld_email, tbl_user.fld_username FROM tbl_user
WHERE tbl_user.fld_username='"&formname&"' AND
tbl_user.fld_password='"&formpass&"'" Set Rs = Con.Execute(sSQL)
IF rs.EOF AND rs.BOF THEN
ELSE
Session("name") = Rs("fld_firstname")
Session("custid") = Rs("fld_user_uid")
Session("Authenticated") = "1"
Response.Redirect("/confirm.asp")
END IF
ELSE
END IF

page3.asp - Should display the confirmation details from the past selections.
All the sessions work apart from the timeselection, it just appears blank. If
I add a bit of text to timeselecion when i declare the session this appears
so it is passing something through. Its driving me mad!

timeselection = Session("timeselection")
custname = Session("name")

'in body works
=(name)
'doesn't display
=(timeselection)
 
P

Patrice

Do you mean that if you try something like :
timeselection="[" & Request.form("timeselection") & "]"
on your postback it will be seen as "[]" in the confirmation page ?

It looks like that Request.Form("timeselection") is empty. Could it be
outside of the form tag ? Display Request.Form to see if its part of the
posted data...

Patrice
 
M

Mark Schupp

When you display the login form on page2.asp include a hidden form field for
timeselection. What is happening is that when page1 posts to page2
"timeselection" has a value. When page2 posts to itself there is no
"timeselection" form element so the timeselection variable is set to "" (or
empty?).
 
P

Patrice

For now I would say that :
1) you save the correct value and displayt that value ("[MM/DD/YYYY]")
2) for some reason you go again on this page but without form values (and
you save "[]")
3) you redirect to the confirmation page that displays "[]"

For now it looks like to me you are hitting twice the
Session("timeselection") = "[" & Request.form("timeselection") & "]" (and
the latter one wihtout anything in Request.Form("timeselection").

Especially I noticed that the timeselection session var is always defined in
your code while the other session variables are defined in an if branch.
Double check your processing flow. Make sure you don't erase the session
variable by another incorrect value (you could output its value before
assignation to make sure you don't replace [MM/DD/YYYY] by [] at some point
before proceeding to the final page.

Good luck.

--

Bateman said:
Do you mean that if you try something like :
timeselection="[" & Request.form("timeselection") & "]"
on your postback it will be seen as "[]" in the confirmation page ?

It looks like that Request.Form("timeselection") is empty. Could it be
outside of the form tag ? Display Request.Form to see if its part of the
posted data...

Patrice


If I do something like
Session("timeselection") = "[" & Request.form("timeselection") & "]"
timeselection = Session("timeselection")
on the page I declare it it will display [6/21/2004 15:00:00] if I
Response.Write (timeselection) however on the next page if I do

timeselection = Session("timeselection")
Response.Write (timeselection)
it will dispaly []
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,996
Messages
2,570,237
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top