• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2351
  • Last Modified:

Passing value through querystring.

Hi,
     I have a form where I want to pass text from a text box to input into a DB.  Here is my code, passing the ID value works but I am drawing a blank on how to pass the form textbox value.  Should I be putting the querystring in the form action property and using a regular submit button?  Thanks for help.

<form method="get" action="NpaUpdate.asp">

     <input type="hidden" name="ID" value="<%=npaRS("ID")%>">
     <input type="text" maxlength="20" size="15" name="wApproval">
     <a href=WowNpaUpdate.asp?ID=<%=npaRS("ID")%>&wApproval</a>Approve</a>

</form>
0
marcus72
Asked:
marcus72
2 Solutions
 
kolluCommented:
Write a small Javascript function as following and pass both the variables

<script language = "javascript">
function PassValues()
{
  var id = document.frmname.ID.value;
  var Approval = document.frmname.wApproval.value;
  window.location.href = "pagename?id="+ id + "&Approval=" + Approval;
}
</script>

<form name = frmname method="get" action="NpaUpdate.asp">

     <input type="hidden" name="ID" value="<%=npaRS("ID")%>">
     <input type="text" maxlength="20" size="15" name="wApproval">
     <a href="PassValues()"</a>Approve</a>
</form>

From next page use variables as request("id) and request("Approval") to get the values
0
 
Night0wlCommented:
Your code is fine so far

but on your page NpaUpdate.asp in the browser it will sayNpaUpdate.asp?wapproval=<the value of the field>

in asp all you need is

varWapproval = response.querystring("wapproval")

this will store the value of wapproval into a variable so you can input it into the database
0
 
Night0wlCommented:
sorry one additional statement. Use a regular submit button with what i wrote above
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
marcus72Author Commented:
Hi,
     Thanks both of you for your quick repsonses.  I tried the javascript function, however, when I try to the link it sending me to a "page cannot be found" page.  The URL is ending in PassValues().  A bigger picture of what I am trying to do is there are going to be multilple rows of records on the page with a textbox where a manager can enter their employee code to approve an employee transaction, so I thought it would be easiest to have a hyperlink at the end of each line that says update and transfer each line information via a querystring rather than posting it through a submit button.  Anyway the Javascript makes sense but isn't taking me to the right page.  Here is how I've written it:

<script language = "javascript">
function PassValues()
{
  var id = document.update.ID.value;
  var Approval = document.update.wApproval.value;
  window.location.href = "http://Server/folder/folder/NpaUpdate.asp?id="+ id + "&Approval=" + Approval;
}
</script>

<form name = frmname method="get" action="NpaUpdate.asp">

     <input type="hidden" name="ID" value="<%=npaRS("ID")%>">
     <input type="text" maxlength="20" size="15" name="wApproval">
     <a href="PassValues()"</a>Approve</a>
</form>


0
 
marcus72Author Commented:
Ok what I've Done is Loop the form for each row.  And it seems to work, I guess I've use a combination of both suggestions is there a way to split the points?
0
 
WMIFCommented:
just above the box you type in, there is a link that says "split".

from the help page:

More than one Expert helped solve my problem. What do I do?
http://www.experts-exchange.com/help.jsp#hi69
0
 
marcus72Author Commented:
Done Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now