Adding content of an input box to a href parameter

C

Col

Hi All,

How do I pass the value selected in "SN" select box to the parameters of
"href=EditRec.asp"?

<font face="Arial"> <u><a href="EditPers.asp?USR2=<%= USER
%>&SNAME=SN">Edit Record</a></u>&nbsp;&nbsp;</font></i></b>

<SELECT NAME="SN">
<option selected="selected">Select Surname...</option>
<%
sConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\inetpub\wwwroot\WORK\PERSONLL.mdb"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.mode = 3
Conn.Open sConnStr
strSQL = "SELECT SURNAME FROM [tblNames] ORDER BY UKEY;"
Set Rs = Conn.Execute(strSQL)
Do While Not Rs.EOF
If NOT ((IsNull(Rs("SURNAME")))or(Rs("SURNAME")=""))Then
Response.Write ("<OPTION value='" & Rs("SURNAME") & "'>" &
Rs("SURNAME")) & " </OPTION>"
End If
Rs.MoveNext
Loop
Rs.Close
Set Rs= Nothing
Conn.Close
Set Conn = Nothing
%>

</select>

It has me stumped at the moment.
I did put an onchange script to put the value in a hidded input box but the
called page could never see it (snm=request.form("snamefld")).
The called page can see the USER parameter (usr=request.querystring("USR2"))

Thanks for any help.

Col
 
S

Stefan B Rusynko

You either need to
- process the form to send results to the page w/ the link that will use SN
SN=request.form("SN")
- or use a client side JavaScript to pass the value of the form to a link below the form
See http://javascript.internet.com/
Right now your link is written before they even select the form
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


| Hi All,
|
| How do I pass the value selected in "SN" select box to the parameters of
| "href=EditRec.asp"?
|
| <font face="Arial"> <u><a href="EditPers.asp?USR2=<%= USER
| %>&SNAME=SN">Edit Record</a></u>&nbsp;&nbsp;</font></i></b>
|
| <SELECT NAME="SN">
| <option selected="selected">Select Surname...</option>
| <%
| sConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Data
| Source=C:\inetpub\wwwroot\WORK\PERSONLL.mdb"
| Set Conn = Server.CreateObject("ADODB.Connection")
| Conn.mode = 3
| Conn.Open sConnStr
| strSQL = "SELECT SURNAME FROM [tblNames] ORDER BY UKEY;"
| Set Rs = Conn.Execute(strSQL)
| Do While Not Rs.EOF
| If NOT ((IsNull(Rs("SURNAME")))or(Rs("SURNAME")=""))Then
| Response.Write ("<OPTION value='" & Rs("SURNAME") & "'>" &
| Rs("SURNAME")) & " </OPTION>"
| End If
| Rs.MoveNext
| Loop
| Rs.Close
| Set Rs= Nothing
| Conn.Close
| Set Conn = Nothing
| %>
|
| </select>
|
| It has me stumped at the moment.
| I did put an onchange script to put the value in a hidded input box but the
| called page could never see it (snm=request.form("snamefld")).
| The called page can see the USER parameter (usr=request.querystring("USR2"))
|
| Thanks for any help.
|
| Col
|
|
 
R

Ronx

One solution is:

<form action="EditPers.asp" method="post">
<input type="hidden" name="USR2" value="<%=USER%>" />
<select name="SN">
<option selected="selected">Select Surname...</option>
sConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\inetpub\wwwroot\WORK\PERSONLL.mdb"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.mode = 3
Conn.Open sConnStr
strSQL = "SELECT SURNAME FROM [tblNames] ORDER BY UKEY;"
Set Rs = Conn.Execute(strSQL)
Do While Not Rs.EOF
If NOT ((IsNull(Rs("SURNAME")))or(Rs("SURNAME")=""))Then
Response.Write ("<OPTION value='" & Rs("SURNAME") & "'>" &
Rs("SURNAME")) & " </OPTION>"
End If
Rs.MoveNext
Loop
Rs.Close
Set Rs= Nothing
Conn.Close
Set Conn = Nothing
%>
</select>
<p><input type="submit" value="Edit Record" /></p>
</form>
 
J

Jens Peter Karlsen [FP-MVP]

Or if using GET instead of POST:
SN=request.querystring("SN")

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
 

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

Top