Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

capturing the values from a form & using it in another page

Status
Not open for further replies.

ifeyinwa

Programmer
Mar 26, 2003
112
US
Thanks guys for yesterday of course the struggle continues.

*have my asp page1.asp here I have 2 forms on this page. In The first form on this page there is no actual texboxes etc just used the submit button put a link on it which takes you to another page.(just serving the purposed of a hyperlink).
the second form is a proper form with a drop down box.The drop down box is populated with fields from the database table. Now when the user picks an option from the drop down this is what I want to happen.

On page1.asp
* The information selected by the user from the drop down box is retrieved/captured which represents a record in the database.
when the submit Button is hit I want it to open another page -page2.asp- where the fields in the database for that record the user selected from the drop down is displayed for the user to update.

This is how I set out to capture the value from the drop down in the form -page1.asp-

Session(userbill) = Request.form("BILLNO") also with the

<form method="POST" action="page2.asp"

In -page2.asp- this is my scripting


<%

Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("adodb.Recordset")
Conn.Open "eiwp"
SQLQuery = "Select * from tblopgaCOm2 WHERE billNo = " & Session(userbill)
RS.Open SQLQuery ,Conn,1,1

but it is given me THESE errors


"Session object error 'ASP 0102 : 80004005'

Expecting string input

/eiwp/audit.asp, line 63

The function expects a string as input".

A RESPONSE APPRECIATED AS ALWAYS

 
ok try this as it is:

Page 1:
Code:
<%
'set the connections 
  Set Conn = Server.CreateObject("ADODB.Connection") 
 Set RS=Server.CreateObject("ADODB.RecordSet") 
 Conn.Open "eiwp" 
 SQLquery = "Select billNo from tblopgaCom2 where area LIKE 'AUDIT' order by reqDate asc"
 RS.Open SQLquery, Conn 
 If RS.EOF then
   Response.write "<center>There are no records in the table"
    Respose.write "<br>please check back later</center>"
    Response.end
  Else
%>
    <p><select size="1" name="BILLNO">
         <option>-Select One-</option>
<%
DO WHILE  NOT RS.EOF  
%>
      <option value="<%Response.Write RS("billNo")%>"><%Response.Write RS("billNo")%></option>    
<%
 Rs.MoveNext
    Loop
  End If
  %>
  </select></td>
 <%
 
 Rs.close
 Set RS = Nothing
 
 Conn.Close
 Set Conn = Nothing
 


 %>
    
  <td width="69">        
  <input type="submit" value="Submit" name="B1"></p>
  </form>

Page 2:
Code:
<%

Set Conn = Server.CreateObject("ADODB.Connection") 
Set Rs = Server.CreateObject("adodb.Recordset")
Conn.Open "eiwp" 
SQLQuery = "SELECT * FROM  tblopgaCOm2  WHERE billNo = '" & [b]Request.Form[/b]("BILLNO") & "' AND area LIKE 'AUDIT'" 
RS.Open SQLquery, Conn 

%>

-VJ
 
WILL THIS WORK ??
SQLQuery = "SELECT * FROM tblopgaCOm2 WHERE billNo = '" & Request.Form("BILLNO") & "' AND area LIKE 'AUDIT'"

PAGE 2 REMEMBER IS NOT A FORM IT JUST DISPLAYS INFORMATION OF A RECORD AND THE RECORD IT DISPLAYS IS BASED ON THE BILLNO FIELD CHOSEN IN THE DROP DOWN BOX OF PAGE 1
 
Yes it does i guess you have the form tags written which you havent shown in your code yet. i assumed you did. if not your code in page one should look like this:

Code:
<%
'set the connections 
  Set Conn = Server.CreateObject("ADODB.Connection") 
 Set RS=Server.CreateObject("ADODB.RecordSet") 
 Conn.Open "eiwp" 
 SQLquery = "Select billNo from tblopgaCom2 where area LIKE 'AUDIT' order by reqDate asc"
 RS.Open SQLquery, Conn 
 If RS.EOF then
   Response.write "<center>There are no records in the table"
    Respose.write "<br>please check back later</center>"
    Response.end
  Else
%>
[b]<form method="POST" action="page2.asp">[/b]
    
<p><select size="1" name="BILLNO">
         <option>-Select One-</option>
<%
DO WHILE  NOT RS.EOF  
%>
      <option value="<%Response.Write RS("billNo")%>"><%Response.Write RS("billNo")%></option>    
<%
 Rs.MoveNext
    Loop
  End If
  %>
  </select></td>
 <%
 
 Rs.close
 Set RS = Nothing
 
 Conn.Close
 Set Conn = Nothing
 


 %>
    
  <td width="69">        
  <input type="submit" value="Submit" name="B1"></p>
  </form>

now that bold line in the code says that you are posting the form values to page 2 and on page 2 you can use Request.Form("BILLNO")

-VJ

 
YOU ARE RIGHT USING THIS Request.Form("BILLNO") WORKED.
THANKS AGAIN .......WHAT A DAY.... THIS ASP/VBSCRIPTING IS NOT EXACTLY EASY!!!!
BUT THANKS THANKS THANKS!!!!! I AM FREE OF ERROR FOR "NOW"

 
No problem,

I am glad that it worked for you in the end.

-VJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top