Solved

how to send textbox value to next page as a parameter

Posted on 2000-03-21
6
203 Views
Last Modified: 2008-01-09
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


0
Comment
Question by:sandeeptyagi
6 Comments
 
LVL 2

Expert Comment

by:anupvijay
ID: 2643250
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
0
 
LVL 4

Accepted Solution

by:
FRehman earned 20 total points
ID: 2643257
simple
<html>
<head>
<script language="Javescript">
 function test()
{
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>
in update page you write it
<%
response.write(request.form("T1"))
%>
by clicking the tag the form will submit and you can get the textbox value on other page
you can also get the value of textbox byu sending it in to querystring method
0
 
LVL 10

Expert Comment

by:Yury_Delendik
ID: 2643348
And I:
<input id="txtField1">
<a href="delete.asp" onclick="window.open(this.href+'?value='+escape(txtField1.value), '_self'); return false;">submit</a>
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:sandeeptyagi
ID: 2643836
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
0
 
LVL 4

Expert Comment

by:FRehman
ID: 2644237
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>
0
 

Author Comment

by:sandeeptyagi
ID: 2647896
FRehman

ur code has worked this time.

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now