![]() |
Send value from Drop Down Selection
I have a Drop Down list populated from an SQL DB and then a submit button to send the selection as a URL Parameter to get details on the next ASP page. I need to be able to send an ID with that in the URL parameter based on the selection I made. I have tried using a hidden field but the ID that gets sent is just the first one in the list and I need it to be the ID in the SQL table of what was selected in the drop down.
ANY help will be appreciated. Thanks Chris |
Show your code as you have it now.
Especially how you populate the <select>. It's really hard to guess what you need from just that description. Might be trivial answer; might be tough. |
Thanks for the reply.....I realize this is crappy dreamweaver code but it's the only way I know how to do this stuff sorry.....
Landname is the dropdown field I have and I select one of those and then click submit to get the detail for that Landname. I need to send over the ID that's in the same table for that selection in the URL Parameter on the detail page. Thanks Code:
<%@LANGUAGE="VBSCRIPT"%> |
Well, you didn't say what the name of your "ID" field is, in the DB table.
So I have just called it ID. If it is something else, just change then names as shown in red. Code:
<%@LANGUAGE="VBSCRIPT"%>Code:
371$$Washington MonumentCode:
landmark = Request.QueryString("landname")Code:
parts = Split( Trim( Request("landname") ), "$$" ) |
OK, I have gotten the data I need in the string but I can't get it to show properly in the link. I didn't understand the last section where I would do that. Here's what I've done, I'm not sure if I'm close to correct since it strays away from your initial code a little bit.
Here's the current code I have for the string: Code:
<option value="<%=name & id%>"><%=name%></option>LandmarkInfo.asp?Landname=WASHINGTONMONUMENT5864 All I need is the &ID=5864 to be there and it will be good but I didn't understand where that code went to accomplish that?? Thanks Chris |
NO NO NO...
You need SOME KIND OF DELIMITER between the name and ID. That's why i *CAREFULLY* used Code:
<option value="<%=id & "$$" & name>"><%=name%></option>Then show me your code for the LandmarkInfo.asp page, if you didn't understand the rest of what I was saying. |
OK, I got your initial line back in there.....here's the code for the landmarkinfo.asp:
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> |
Okay, try this replacement. (I truly *HATE* DreamWeaver code. I cleaned up a lot of it, but not all. But enough to make this somewhat more efficient, at least. The stuff in red is the important part. Other changes not as important, but they will make your code more efficient if you use them.)
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> |
If it's not obvious, all the other changes took the form of replacing this DrunkWalker crap:
Code:
<%=(RSLandmarks.Fields.Item("ContactType1").Value)%>Code:
<%=RSLandmarks("ContactType1")%> |
Works like a charm!!! THANK YOU!!!
Chris |
You know, I'm going to guess that there is one more thing you should do.
Replace this code: Code:
<tr>Code:
<% |
| All times are GMT +1. The time now is 06:05 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.