Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Passing Variables across multiple pages

Posted on 2006-06-11
3
Medium Priority
?
712 Views
Last Modified: 2012-06-21
I have the following code I am trying to pass the form variable from across two pages.  I am using the first page confirmation.asp as a page that users get to see their choices prior to submission to the database.  This page is working correctly.  I have included a form with a hidden field of the confirmation page with the value

    <input name="proselected" type="hidden" value="<%Request.Form("progSelected[]")%>" />

I want to pass this value to a submit.asp page.  I am getting the following error.  

Microsoft VBScript runtime  error '800a01a8'

Object required: ''

/memberapp/seminar/submit.asp, line 12

Here is the code for the confirmation.asp page

<%
Response.write ("Please Print this page to confirm your seminar choices") & ("<br><br><br>")

Dim vSelectedSeminars,vSeminarID,vInstr,vCount, semname
vCount=0
Dim vSQLString
Dim nString
Dim objRS : Set objRS = Server.CreateObject("ADODB.Recordset")
      obj_conn.Execute("Delete from seminarregistration where memberid = " & Session("memId"))
      obj_conn.Execute("Delete from seminaruserchoices where memberid = " & Session("memId"))
      vSelectedSeminars = Request.Form("progSelected[]")
      while len(vSelectedSeminars) > 0  
            vInstr = instr(vSelectedSeminars,",")
            if vInstr = 0 then
                  vSeminarID = vSelectedSeminars
                  vSelectedSeminars = ""
            else
                  vSeminarID = mid(vSelectedSeminars,1,vInstr-1)            
                  vSelectedSeminars = mid(vSelectedSeminars,vInstr+1,len(vSelectedSeminars))
            end if
      
      if vCount = 0 then
                  'vSQLString = "Insert Into SeminarRegistration(SeminarID,MemberID,RegistrationDate) Values("& vSeminarID & "," & Session("memId") & ",'"& now()&"')"
   
            'response.write (vSeminarID)
               On Error Resume Next
               obj_conn.Execute(vSQLString)
             end if
            vCount = vCount+1
            'vSQLString = "Insert Into SeminarUserChoices(SeminarID,MemberID,PreferenceNumber) Values("& vSeminarID & "," & Session("memId") & "," & vCount & ")"
nString = "select name from seminar where seminarid = '" & vSeminarID & "'"            
'response.Write(vSeminarID)
              set RS=obj_conn.Execute(nString)
              if not (RS.eof and RS.bof) then
               Do while not RS.eof
               response.Write(RS("name")) & ("&nbsp; &nbsp; ") & vcount & ("<br>")
           
         RS.Movenext
               Loop
          end if  
            On Error Resume Next
            obj_conn.Execute(vSQLString)            
      wend
%>

<form id="form1" name="form1" method="post" action="submit.asp">
  <p>
    <input name="proselected" type="hidden" value="<%Request.Form("progSelected[]")%>" />
</p>
  <p>
    <label>
    <input type="submit" name="Submit" value="Submit" />
    </label>
</p>
</form>


here is the code for the submit.asp page

<%
Response.write ("Please Print this page to confirm your seminar choices") & ("<br><br><br>")

Dim vSelectedSeminars,vSeminarID,vInstr,vCount, semname
vCount=0
Dim vSQLString
Dim nString
Dim objRS : Set objRS = Server.CreateObject("ADODB.Recordset")
      obj_conn.Execute("Delete from seminarregistration where memberid = " & Session("memId"))
      obj_conn.Execute("Delete from seminaruserchoices where memberid = " & Session("memId"))
      vSelectedSeminars = Request.Form("proSelected[]")
      while len(vSelectedSeminars) > 0  
            vInstr = instr(vSelectedSeminars,",")
            if vInstr = 0 then
                  vSeminarID = vSelectedSeminars
                  vSelectedSeminars = ""
            else
                  vSeminarID = mid(vSelectedSeminars,1,vInstr-1)            
                  vSelectedSeminars = mid(vSelectedSeminars,vInstr+1,len(vSelectedSeminars))
            end if
      
      if vCount = 0 then
                  'vSQLString = "Insert Into SeminarRegistration(SeminarID,MemberID,RegistrationDate) Values("& vSeminarID & "," & Session("memId") & ",'"& now()&"')"
   
            'response.write (vSeminarID)
               On Error Resume Next
               obj_conn.Execute(vSQLString)
             end if
            vCount = vCount+1
            'vSQLString = "Insert Into SeminarUserChoices(SeminarID,MemberID,PreferenceNumber) Values("& vSeminarID & "," & Session("memId") & "," & vCount & ")"
nString = "select name from seminar where seminarid = '" & vSeminarID & "'"            
'response.Write(vSeminarID)
              set RS=obj_conn.Execute(nString)
              if not (RS.eof and RS.bof) then
               Do while not RS.eof
               response.Write(RS("name")) & ("&nbsp; &nbsp; ") & vcount & ("<br>")
           
         RS.Movenext
               Loop
          end if  
            On Error Resume Next
            obj_conn.Execute(vSQLString)            
      wend
%>
0
Comment
Question by:drai123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 33

Accepted Solution

by:
sajuks earned 2000 total points
ID: 16883421
  <input name="proselected" type="hidden" value="<%Request.Form("progSelected[]")%>" />
should be
<input type="text" name="proselected" value="<%=Request.Form("progSelected[]")%>">

you are missing the "=" sign .
0
 

Author Comment

by:drai123
ID: 16883511
I am still getting the error on the submit page.  

the error is this line

     obj_conn.Execute("Delete from seminarregistration where memberid = " & Session("memId"))


Microsoft VBScript runtime  error '800a01a8'

Object required: ''

/memberapp/seminar/submit.asp, line 12  
0
 
LVL 33

Expert Comment

by:sajuks
ID: 16883633
also is ur obj_conn declared ?
set obj_conn=Server.CreateObject("ADODB.Connection")
ConnectionString="PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & databpath
obj_conn.Open ConnectionString

and change this to
set rsseminarreg= obj_conn.Execute("Delete from seminarregistration where memberid = " & Session("memId") & ";" )
  set rsuserchoice= obj_conn.Execute("Delete from seminaruserchoices where memberid = " & Session("memId") & ";" )


' if ur memebr id is string
strsql="delete from seminarregistration  where memberid ='" & session("memId") & "';"
' if ur memebr id is numeric
strsql="delete from seminarregistration  where memberid =" & session("memId") & ";"
set rsmembers=obj_conn.Execute(strsql)
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question