Current location: Hot Scripts Forums » Programming Languages » ASP » Sending data from a link


Sending data from a link

Reply
  #1 (permalink)  
Old 07-08-07, 12:33 AM
zanchi zanchi is offline
Newbie Coder
 
Join Date: Jul 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Sending data from a link

HI, I have some problem when I'm trying to access data from 1 page to another using the ProductID.

First Page - This one seems to be OK

<a href="mobilephonesdetails.asp?Productid=<%= rs.Fields("ProductID").Value %>"><%= rs.Fields("Model").Value %>

I want that the previous link for example mobilephonesdetails.asp?ProductID=2

will be displayed to another page. I already have the following code:
asp Code:
  1. <%
  2. set conn=Server.CreateObject("ADODB.Connection")
  3. conn.Provider="Microsoft.Jet.OLEDB.4.0"
  4. conn.Open(Server.Mappath("technocom.mdb"))
  5.  
  6. set rs = Server.CreateObject("ADODB.recordset")
  7. rs.Open "SELECT ProductID, Logo, Model, Image1, Brand FROM Products WHERE productID=[COLOR="DarkOrange"]2[/COLOR]", conn
  8. %>
  9.  
  10. </p>
  11. <table border="0" cellpadding="10" cellspacing="10">
  12.  
  13. <tr>
  14.   <td width="151"><img src="<%= rs.Fields("Image1").Value %>" width="139" height="184"></td>
  15.   <td width="152">&nbsp;</td>
  16.   </tr>
  17. </table>
  18. <%
  19. ' Close our recordset and connection and dispose of the objects
  20. rs.Close
  21. set rs = Nothing
  22. conn.Close
  23. set conn = Nothing
  24. %>

Last edited by Nico; 07-08-07 at 07:25 PM. Reason: Please use [highlight=asp] wrappers.
Reply With Quote
  #2 (permalink)  
Old 07-08-07, 08:39 PM
koncept
Guest
 
Posts: n/a
maybe im missing something but im not exactly sure what the problem that you are trying to resolve??
Reply With Quote
  #3 (permalink)  
Old 07-09-07, 06:40 AM
blake blake is offline
Newbie Coder
 
Join Date: Jun 2007
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
I'm not sure if I understand...

I think you're looking for a way to pass a query string on to another page, right?

Page 1:
Quote:
<a href="file.asp?id=<%=someAspVariable%>">Go to Page 2</a>
Page 2:
Quote:
<%
dim inID
inID = request.querystring("id")

if inID = "" then
'nothing was entered
else
'received a querystring
response.write(inID) 'this writes out the ID in 'someAspVariable' from page1
end if
%>
Hope this helped... If not, please explain again what you're looking for...
__________________

Help me win money, vote for these:
ASP, count months... - Basic ASP ADO database connection code...
Reply With Quote
  #4 (permalink)  
Old 07-10-07, 01:23 PM
zanchi zanchi is offline
Newbie Coder
 
Join Date: Jul 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Yes that helped a little bit but now I need something that display data from the database with that productID chosen from previous page.

Thanks
Reply With Quote
  #5 (permalink)  
Old 08-02-07, 09:59 AM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
Pass the ID of the previous page in the querystring too:


Page 1:


Quote:
<a href="file.asp?id=<%=someAspVariable%>&previouspag e=<%=CurrentProductID%>">Go to Page 2</a>
Page 2:

Quote:
<%
dim inID, prevID
inID = request.querystring("id")
prevID = request.querystring("previouspage")
if inID = "" then
'nothing was entered
else
'received a querystring
<a href="file.asp?id=<%=prevID%>">Go Back to Page 1</a>
end if
%>
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Six Sites Exchanging Links! - PR3+ Web Hosting, Web Design, Entertainment & Career coffeecoder General Advertisements 0 10-10-05 12:52 AM
Xml / Dom / Css Mark_SC.SE JavaScript 0 06-29-05 08:05 AM
Mail Script sending multiple times when Table has a lot of data dsumpter PHP 12 07-16-03 05:17 PM


All times are GMT -5. The time now is 03:59 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.