|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Complications with variable passing
Hi there,
I'm having problems with passing variables to another asp page. This is due to the fact that the variables I want to pass are getting captured in an email (this is fine) but are not going to the next page.(not fine !) Ok, so heres what I want to do.... Basically I have 2 pages and on the first is a form, which currently has it variables being captured and emailed using POST and a CGI action which sends them to an email address. This stuff can't be changed as the action is on an external server, which I don't have access to. What I want to do is to duplicate the variables I need so they get passed the the next page, aswell as going off in the email. At the moment, they just get captured and no variables come to the next page. I was thinking maybe I could add some sort of hidden form, that has the same hidden fields names, but doesn't get emailed, it just goes to the next page, but wasn't sure how it would duplicate the information that has been entered into the visual form. The only fields I was to pass are 'First_Name', 'Last_Name' and 'Email' If anyone has any ideas on how to do this, that would be much appreciated. I did see a similar post, but couldn't quite get it to do what I wanted. Thanks in advance.... Jon |
|
#2
|
|||
|
|||
|
If the *only* fields you need are 'First_Name', 'Last_Name' and 'Email'
Then why not use cookies ? Put them into cookies then, on your second page retrieve the values from the cookies? no? Hope this helps! Sincerely Vlince |
|
#3
|
|||
|
|||
|
Putting the values into Session variables would be more efficient and more robust.
Code:
Session("myvalue") = Request.Form("myformfield")
...
strMyValue = Session("myvalue")
|
|
#4
|
|||
|
|||
|
How would that be *would be more efficient* then cookies ?
I'm curious(besides the fact that a cookie can only hold a small amount of data) but since the poster only wanted the 'First_Name', 'Last_Name' and 'Email' then cookies is efficient enough! But its definitely not *more robust* in fact, each time you declare/use a Session variable it uses a chunk of memory on the server(Ya ok a small chunk) but its still a chunk. Multiply that chunk of memory by 1000 users a day for example and what if the user goes out for lunch, comes back an hour later. No activity on the site for an hour, decides to cotinue with what he/she was doing, you've completely lost the content of the data inside the Session variables(Of course you could always set the timeout to 5 hours if you wanted but wouldn't that be *less robust*?) For small jobs/data stick with cookies(unless you want to pass the data via the QueryString) Oh and if someone says "But what if the user's browser don't support cookies?" well in that case, Session variables wont work either...try it! I'm curious that's all ![]() Vlince |
|
#5
|
|||
|
|||
|
Quote:
|
|
#6
|
|||
|
|||
|
Here is a good article:
http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=30 The last paragraph says it all Of course, if, on another page, the value of Session("Message") is referenced, only those users who have cookies enabled will have a value of "Hello, World!" there. Vlince |
|
#7
|
|||
|
|||
|
I didn't know that
![]() Even so, less bandwidth used with a session so it should be quicker (less i/o as a result). If cookies are disabled neither method would work. |
|
#8
|
|||
|
|||
|
Quote:
Hi there, thanks for all the replies, much appreciated ! echolalia - I'm basically trying to pass the form variables to the second page, but at present they get captured in a cgi script and emailed without being passed to the next page. I think what I need to do, is somehow save them (as suggested by the other guys, maybe using cookies or session variables), or duplicate them so that one set of information is emailed, and the other (duplicate) is also passed to the next page. Shad & Vlince, - thanks for your suggestions here guys, I haven't done much with either cookies or session variables, but will definitely investigate both options as hadn't considered them before. Many thanks for all replies Jon |
|
#9
|
|||
|
|||
|
Hi guys,
I'm still not having much luck with this, echolalia- I tried your code, but can't quite follow it, where do I need to put the ; <body onLoad="document.getElementById('form1').submit()"> and I'm presuming the above, shouldn't be in asp tags? I noticed that you then have the form request code, but I have this code on my second page, where I want to display the data. If you might be able to give me a few more pointers for the code, that would be great (my coding is not that great !) Shad - I have tried but, with no avail to get session variables to work. On my first page (I'm using dreamweaver MX) I have my 3 input boxes for first_name, surname, email and have created session variables to match these.... i.e. <input name="first_name" type="text" id="first_name" value="<%= Session("first_name") %>"> I can only get these to show on the next page if I remove the email function, as it still seems to be capturing the code and not passing it to the next page. So my variables are empty on the other page. My code to display the variables is simply... <%= Session("first_name") %> I just put this on the page and it works fine, when the email function is disabled. On another note, I'm wondering if it might be worth trying to use a mail program such as CDONTS, as maybe this might allow variables to be passed, rather than just capturing them and emailing them, without passing to the next page? If anyone has any ideas, that would be appreciated ! Many thanks Jon |
|
#10
|
|||
|
|||
|
Hi echolalia,
Thanks for clarifying that, I'm trying to implement the code, but where I have entered the; <body onLoad="document.getElementById('form1').submit()"> it is within my other onload content, i.e.... onLoad="document.getElementById('theForm').submit()","MM_preloadImages('images/over/leftmenu_02.gif' ,'images/over/leftmenu_04.gif','images/over/leftmenu_05.gif','images/over/leftmenu_06.gif"> However, as soon as the page then loads, my form gets submitted before I have a chance to enter anything in it? I can only assume that I have entered this code at the wrong stage of the page? If you have any ideas, that would be much appreciated, as I'm a bit stuck at the moment ! Thanks Jon |
|
#11
|
|||
|
|||
|
Hi echolalia,
Don't worry about the previous comment, I have managed to fix it using CDONTS, and removing the CGI email function. This works as CDONTS passes the variables to the second page, and then sends them, rather than sending on the first page. Many thanks for your (and others) replies, all of which, much appreciated. Kind Regards Jon |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Complications with variable passing |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|