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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Session Variable Question From a Newbie!

Status
Not open for further replies.

sallieann

Programmer
Sep 2, 2003
28
GB
Can anybody help a newbie?!

I have created an ASP page which lists all the current jobs in an Access database with a reference number for applicants to quote when making about the job.

When the user clicks on the enquire button next to the job, an enquiry form pops up. I would like this enquiry form to already have the job reference number entered.


The code for the enquire button is as follows;

<a href=&quot;javascript:;&quot; onClick=&quot;MM_openBrWindow('sallie_enquire.htm','','width=320,height=380')&quot;><img src=&quot;enquire.gif&quot; border=&quot;0&quot;></a></div>


The code for the input box on the enquiry page is as follows;

<input type=&quot;text&quot; class=&quot;box&quot; name=&quot;RefNo&quot; maxlength=&quot;10&quot; size=&quot;20&quot; >


I understand that I need to use session variables but do not know how to structure the code. I'd be really grateful for any advice as I am tearing my hair out!
 
It would be a lot easier to start with listing the jobs with there reference numbers and listing your enquiry buttons/links with the reference number alo, then you would have the reference number to do as you wish...

ie


<input type=&quot;text&quot; class=&quot;box&quot; name=&quot;RefNo&quot; maxlength=&quot;10&quot; size=&quot;20&quot; value=&quot;12345&quot;>



<a href=&quot;javascript:;&quot; onClick=&quot;MM_openBrWindow('sallie_enquire.asp?jobref=123456','','width=320,height=380')&quot;><img src=&quot;enquire.gif&quot; border=&quot;0&quot;></a></div>


Just change you html pages to asp?
 
First of all you don't have to use session variables if you don't want to. Second I would suggest making your enquiry form into an asp page rather than a htm page.

When you write the code for your first page (which includes the button to access the enquiry page) you could write the value out as a querystring, i.e.
Code:
<a href=&quot;javascript:;&quot; onClick=&quot;MM_openBrWindow('sallie_enquire.asp?ENQUIRYID=<%rs(&quot;ID&quot;)%>','','width=320,height=380')&quot;><img src=&quot;enquire.gif&quot; border=&quot;0&quot;></a></div>
Obviously in the above example you would change rs(&quot;ID&quot;) to the name of your recordset and field name. Then on your enquiry page you could list the enquiry ID by using:
Code:
<%response.write request.querystring(&quot;ENQUIRYID&quot;) %>






----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
If you only want to carry the value of the text box to the next page you can use the Request.Form function.

On Form Page:
Code:
<form ACTION=&quot;FileToPostTo.asp&quot; METHOD=&quot;POST&quot;>
  <p><select NAME=&quot;RefNo&quot; SIZE=&quot;1&quot; id=&quot;TypeTrainRD&quot; tabindex=&quot;1&quot;>


On Recieving Page:
Code:
Request.Form(&quot;RefNo&quot;)

If you want the value available to other pages after that, then you would probably want to use a session variable.

coachdan32

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top