Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyperlink problem

Status
Not open for further replies.

NewItron

Programmer
Nov 21, 2003
21
IN
Hi,
Can anybody please help me out with the following problem:-
I have a page where I have opened a connection with the database (MS access).I have 2 hyperlinks.I need to divert the control to different pages depending upon which hyperlink is clicked.One of the page to which the control is diverted displays data from the database.If I go to that page through hyperlink,I am afraid I will loose all the data retrieved from the database.I do not want to use buttons for redirecting the control to different pages.
Awaiting your replies.
Regards
NewItron
 
I am not sure this is the best solution, but it is an option. If your data is being retrieved into a form, you can use hidden form fields to hold the data. However, this will only work if you POST the data to the next page. In order to do this with an href, you would likely need an onclick event in the href which would set the form value based on which href was clicked and then submit the form. An example of what I am trying (unsuccesfully, I fear) to explain:
Code:
<script language=&quot;javascript&quot;>
//this is the javascript function.
function sendThis(x) {
{
if(x == 1)
  frmMain.action = &quot;Page1.asp&quot;
else
  frmMain.action = &quot;Page2.asp&quot;
}
frmMain.submit()
}
</script>

<form name=&quot;frmMain&quot; method=&quot;post&quot;>
<input type=&quot;hidden&quot; name=&quot;Val1&quot; value=&quot;<%=dbVal1%>&quot;>
<input type=&quot;hidden&quot; name=&quot;Val2&quot; value=&quot;<%=dbVal2%>&quot;>
<a href=&quot;#&quot; onclick=&quot;return sendThis(1)&quot;>
<a href=&quot;#&quot; onclick=&quot;return sendThis(2)&quot;>
</form>

That is just an idea, but should convey the idea of one possible solution. If you have additional questions, let me know.

-----------------------------------------------------------------------------------------------------
&quot;If you can't explain something to a six-year-old, you really don't understand it yourself.&quot;
-- Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top