开发者

Passing parameter and user input

开发者 https://www.devze.com 2023-03-27 07:41 出处:网络
I am trying to pass a few parameter and a user input to a search_form.asp page. <form action=\"search_form.asp\" method=\"Post\">

I am trying to pass a few parameter and a user input to a search_form.asp page.

<form action="search_form.asp" method="Post">     
    <input type="text"name="fname"/></th>             
    <input type="submit" value="Update">
</form>

<a href="search_form3.asp?RecId=<%=registerRS.Fields("id")%>&Lname=%=registerRS.Fields("lname")%>"></a>

And on search_fo开发者_如何学运维rm.asp...

lname=request.QueryString("Lname")
fname=request.form("fname")

But I am unable to see lname when i place Response.Write("<p>Name: " & lname) in search_form.asp


The query string is not preserved when you submit the form, so search_form.asp will not have a query string. As an alternative, could you include the query string as a hidden field:

 <form action="search_form.asp" method="Post">
      <input type="text"name="fname"/></th>
      <input type="submit" value="Update">
      <input type="hidden" name="lname" value="<%=Request.QueryString("lname")%>" />
  </form>

And then refer to Request.Form("lname") in search_form.asp.

Alternatively, could you include the query string in the form action?

 <form action="search_form.asp?<%=Request.ServerVariables("QUERY_STRING")%>" method="Post">
      <input type="text"name="fname"/></th>
      <input type="submit" value="Update">
      <input type="hidden" name="lname" value="<%=Request.QueryString("lname")%>" />
  </form>

This should pass the query string on the original page when the form is submitted.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号