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

Hello I am hoping somebody may b

Status
Not open for further replies.

Huitzilopochtli

Programmer
Feb 18, 2002
81
DE
Hello

I am hoping somebody may be able to throw me a lifeline here!

I use some simple variables in a form so that when it is submitted, the visitor receives a copy of his CDONTS-based e.mail to the Webmaster as in:

Name: John Smith
E.mail: John@Smith.com
Comments: Whatever

For instance:

Dim t1name,t1,t2name,t2
t1name = "name"

while the script behind the form looks like this:

<input type=&quot;text&quot; name=&quot;T1&quot; size=&quot;15&quot;>

At the same time, I would also like to use some VBScript to get the user's name so that a personalised 'Thank you' Web page is called.

I do this on another site using:

<input type=&quot;text&quot; name=&quot;user_name&quot; size=15> on the page which holds the form, and:

<% @ Language=VBScript %>
<% user_name = request.form(&quot;user_name&quot;) %>
<p>Thank you <%=user_name%></p>

on the 'Thank you' page itself.

But how can I combine the two? That is, how can I personalise a 'Thank you' page, AND use the t1 variable which I have used above? I'm stuck because I am not sure if this is possible:

<input type=&quot;text&quot; name=&quot;user_name&quot; size=15>
<input type=&quot;text&quot; name=&quot;T1&quot; size=&quot;15&quot;>

Thank you for any suggestions?

Huitzilopochtli
 
submit the form to your cdonts page and after sending the mail redirect this to the thank you page. While redirecting pass the name variable on the URL

e.g. response.redirect(&quot;thankyou.asp?name=&quot;&user_name&&quot;)

in the thank you page fetch this variable

username =request.QueryString(&quot;user_name&quot;)
 
Hello Newbiepg

Many thanks for your reply.

I pasted the following:

<%response.redirect(&quot;welcome1.asp?name=&quot;&user_name&&quot;)%>

into the email.asp file I have (the one which contains the form), and

<% user_name = request.form(&quot;user_name&quot;) %>

together with

<p>Thank you <%=user_name%></p>

in welcome1.asp which shows the 'Thank you' message.

The server didn't allow me to even see the form, before it displayed the following error message:

Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/final/email.asp, line 1

response.redirect(&quot;welcome1.asp?name=&quot;&user_name&&quot;)

Why would it show that kind of error message? All I have done is substitute your

response.redirect(&quot;thankyou.asp?name=&quot;&user_name&&quot;)

for my

response.redirect(&quot;welcome1.asp?name=&quot;&user_name&&quot;)

Many thanks again.

Huitzil


 
first thing I see is you're calling the values with request.form but you're passing the value as a querystring so you need to do
request.querystring(uer_name&quot;)

then thre redirect doesn't get () I believe
instead of trying to mess with redirection with a concatinated value as you are, do these mod's in a variable to simplify debiugging etc..
dim url
url = &quot;welcome1.asp?name=&quot; & user_name

response.redirect url _______________________________________________
[sub]{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }[/sub]
_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
just to answer your actual question on the erro
response.redirect(&quot;welcome1.asp?name=&quot;&user_name&&quot;)
count the &quot;
your not closing the string hence the unterminating string error
_______________________________________________
[sub]{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }[/sub]
_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
Hello onpnt

Many thanks for your message.

Unfortunately, I can't seem to get that to work: the script sends the e.mail back to the visitor which is what I wanted, as in:

name
Jazzy
email
ehigam2002@yahoo.com
comments
Test Jazzy

In other words, the:

<input type=&quot;text&quot; name=&quot;T1&quot; size=&quot;15&quot;>

still works, and the 'Thank you' page is called once the form is submitted, but the:

dim url
url = &quot;welcome1.asp?name=&quot; & user_name

response.redirect url

doesn't seem to be working.

It is certainly something I am doing wrong, so I will experiment with it a bit more and see how it goes.

Thank you again.

Huitzil
 
the error is right here

<%response.redirect(&quot;welcome1.asp?name=&quot;&user_name&&quot;)%>
it should be
<%response.redirect(&quot;welcome1.asp?name='&quot;&user_name&&quot;' &quot;)%>
you can omit the single quotes if the username will be one word

see you started the redirect quote but did not end it

Also there is a problem in the flow
First let there be a form a.asp
here let the user enter his name, email details etc
submit this form to b.asp
here use CDONTS to send the message
in b.asp
after sending the mail
write this line at the end
<%response.redirect(&quot;welcome1.asp?name='&quot;&user_name&&quot;' &quot;)%>

then in welcome1.asp

user_name = request.querystring(&quot;user_name&quot;)

this will let you fetch the variable

 
Hello Newbiepg

Many thanks again for your reply.

I now have 3 files as you have suggested. One is the form with the input fields on it. This form refers to what you call fileb.asp as in:

<form name=&quot;welcome&quot; method=&quot;POST&quot; action=&quot;fileb.asp&quot; etc and contains the variables necessary to send the form to the Webmaster and to the visitor, as in:

<input type=&quot;text&quot; name=&quot;T1&quot; size=&quot;15&quot;>

In the e.mail which the Webmaster receives from the Web page, this produces something like the following:

name
Jazzy
email
ehigam2002@yahoo.com
comments
Test Jazzy

In fileb.asp, I have EXACTLY the following, including the line of code you suggested I should include at the bottom:

<% @ Language=VBScript %>
<%Response.Buffer=True%>

<%
Dim t1name,t1,t2name,t2
t1name = &quot;name&quot;
t1 = Request.Form(&quot;t1&quot;)
t2name = &quot;email&quot;
t2 = Request.Form(&quot;t2&quot;)
Dim stname,st
stname = &quot;comments&quot;
st = Request.Form(&quot;s1&quot;)
Dim ObjMail
Set ObjMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
ObjMail.To = &quot;Java1@aol.com&quot;
ObjMail.CC = t2
ObjMail.From = t2
ObjMail.Subject = &quot;Feedback&quot;
ObjMail.Body = t1name & vbcrlf&_
t1 & vbcrlf&_
t2name & vbcrlf&_
t2 & vbcrlf&_
stname & vbcrlf&_
st
ObjMail.Send
Set ObjMail = Nothing
%>

<%response.redirect(&quot;welcome1.asp?name='&quot;&user_name&&quot;' &quot;)%>

So far, I think, so good.

And on the welcome1.asp page, I have pasted in your:

user_name = request.querystring(&quot;user_name&quot;)

When I submitted the form,

user_name = request.querystring(&quot;user_name&quot;)

appeared on the Web page itself, so I substitiuted your line of script with:

<%user_name = request.querystring(&quot;user_name&quot;)%>

The 'Thank you' page was called, but there was nobody's name there (it wasn't personalised), so I tried:

<%user_name%> = request.querystring(&quot;user_name&quot;) and get:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'user_name'

welcome1.asp, line 53

Please note that in the welcome1.asp page I have:

<% @ Language=VBScript %>

because I understood that that line should be there.

So, as you can see, I have different bits of scripts coming out of my ears, and am totally confused now about where they all belong!

One thing I would say is that on the form itself (your filea.asp), there is no reference to user_name or <%user_name%>, because I have the t1 variable there for 'name'. Isn't this the cause of the problem?

Many thanks Newbiepg - much appreciated!

Huitzil




 
you have got things right when you wrote

<%user_name = request.querystring(&quot;user_name&quot;)%>


after this line you need to write

<% response.write(user_name)%>

and the name will show

if it does not work still give me your email and I will send you the pages

 
Hello Newbiepg

Thanks again for your post.

I have this:

<%user_name = request.querystring(&quot;user_name&quot;)%>
<% response.write(user_name)%>

and the welcome1.asp file is called, but there is no name (not personalised).

If you could send me the pages I would be grateful. I won't simply copy them, but will try to understand the logic of the code.

My e.mail is: visuallybasic2002@yahoo.com

Thanks again for your time and efforts.

Huitzil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top