Link to home
Start Free TrialLog in
Avatar of sandeeptyagi
sandeeptyagi

asked on

how to send textbox value to next page as a parameter

I have got three asp pages , search.asp, update.asp and delete.asp search page has got a form (name of form is form1 and it contains just one textbox "id" and a submit button whose action is update.asp so the submit button takes me to update page where i can do the updation using request.form("id") in my sql command.

now there is also hyperlink on the search.asp which whould lead me to delete.asp, i think i need to explicitly pass the value of "id"'s value in <a> tag using ?. i tried it but couldn,t pass the value.

now the questions are:
1. is it possible to send variables using <a> tag, if yes then how?
2. is there some other method to acheive my goal like instead of using submit button/ hyperlink , should i use response.redirect method (which i had tried actually without any success)

Thanks in advance
sandeep


Avatar of anupvijay
anupvijay
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi sandeeptyagi
yes you can pass values to the  next page using the <A> tag
It is something like given below
<A href="delete.asp?varname1=xyz&varname2=abc">link</A>
Where
varname1 will be the variable you will be passing value in and xyz is the value of that variable.
To reteive this in the delete.asp
You can do the following
x=Request.Querystring("varname1")
y=Request.Querystring("varname2")
There you are.....
Tell me if this is working or not ,It should as i am dong my work through this only
About the response.redirect method also you can do the same sort of thing
Response.Redirect "delete.asp?varname1=xyz&varname2=abc"
and same method can be used to retrive data.
All the best
ASKER CERTIFIED SOLUTION
Avatar of FRehman
FRehman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Yury_Delendik
Yury_Delendik

And I:
<input id="txtField1">
<a href="delete.asp" onclick="window.open(this.href+'?value='+escape(txtField1.value), '_self'); return false;">submit</a>
Avatar of sandeeptyagi

ASKER

anupvijay

abc and xyz are not fixed value but textbox's values. and could be
just anything under the sun.so i cant' write varname1=abc

FRehman

HTTP Error 404
404 Not Found

this is what i got when clicked the hyperlink. perhaps u have mistyped
the syntax of <a> tag. if so please check it out.

 Yury_Delendik
ur code did open a new window but couldn't get me the value.
may be u too mistyped something. so please look at ur code once again.

sandeep
sorry for little mistake now I check it and it run in my computer well if you find any problem then let me know at leo_faisal@yahoo.com
<html>
<head>
<script language="Javascript">
 function test()
{
alert("dfg")
document.form1.action="update.asp"
document.form1.submit();
}
</script>
</head>
<HTML>
<BODY>
<FORM name=form1 method=post>
<input type="text" name="T1">
<a href="Javascript:test()">click it</a>
</form>
</body>
</html>
FRehman

ur code has worked this time.

my thanx to you .
see u with some other question later
 
sandeep