How to Get Rid of Commas

T

tp_michele_jones

Hi,

I'm collecting an email address in one asp page as follows:

<%@ Language="VBScript"%>
<%Option Explicit%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Mailing Services</title>
</head>
<html>
<body topmargin="0" leftmargin="0" bgcolor="#000000" text="#000000"
link="#000000" vlink="#000000" alink="#000000">
<form method="POST" action="overstockconf.asp">
<table border="0" cellpadding="0" cellspacing="0" width="650">
<tr>
<td></td>
<td>E-mail</td>
<td><input type="TEXT" name="Email" size="50"></td>
</tr>
</table>
<%
Response.Write ("<input type=hidden name=Email value=" &
request.querystring("Email") & ">")
%>
</form>
</body>
</html>

And then I'm printing it out in a second asp page and an email as
follows:

<%@ Language="VBScript"%>
<%Option Explicit%>
<%
Dim strEmail
strEmail = Request.Form("Email")
strFrom = "(e-mail address removed)"
strTo = "(e-mail address removed)"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Mailing Services-Confirmation</title>
</head>
<html>
<body topmargin="0" leftmargin="0" bgcolor="#000000" text="#ffffff"
link="#990033" vlink="#003300" alink="#cc6600">
<form method="POST" action="overstockconf.asp">
<table border="0" cellpadding="0" cellspacing="0" width="650">
<tr>
<td>&nbsp;</td>
<td>Email</td>
<td><%= Request.Form("Email")%></td>
</tr>
</table>
<%
Dim objMail
Set objMail = CreateObject("CDONTS.NewMail")
objMail.From = strFrom
objMail.To = strTo
objMail.Subject = "Overstock Confirmation"
StrMessage = strMessage & "Authorizing Person's Email - " &
Request.Form("Email") & vbCrLf
objMail.Body = strMessage
objMail.Send
Set objMail = nothing
%>
</form>
</body>
</html>

Both the second asp page and the email add a comma after the email
address that was entered in the field in the first asp page. Does any
one know how to get rid of it.

I'm a new web developer and have lots of books all over my desk. I've
check news groups, but I still can't seem to figure this one out. I'm
hoping it's a silly little mistake.

Thanks,

Michele
 
A

Augustus

Hi,

I'm collecting an email address in one asp page as follows:

<%@ Language="VBScript"%>
<%Option Explicit%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Mailing Services</title>
</head>
<html>
<body topmargin="0" leftmargin="0" bgcolor="#000000" text="#000000"
link="#000000" vlink="#000000" alink="#000000">
<form method="POST" action="overstockconf.asp">
<table border="0" cellpadding="0" cellspacing="0" width="650">
<tr>
<td></td>
<td>E-mail</td>
<td><input type="TEXT" name="Email" size="50"></td>
</tr>
</table>
<%
Response.Write ("<input type=hidden name=Email value=" &
request.querystring("Email") & ">")
%>
</form>
</body>
</html>

And then I'm printing it out in a second asp page and an email as
follows:

<%@ Language="VBScript"%>
<%Option Explicit%>
<%
Dim strEmail
strEmail = Request.Form("Email")
strFrom = "(e-mail address removed)"
strTo = "(e-mail address removed)"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Mailing Services-Confirmation</title>
</head>
<html>
<body topmargin="0" leftmargin="0" bgcolor="#000000" text="#ffffff"
link="#990033" vlink="#003300" alink="#cc6600">
<form method="POST" action="overstockconf.asp">
<table border="0" cellpadding="0" cellspacing="0" width="650">
<tr>
<td>&nbsp;</td>
<td>Email</td>
<td><%= Request.Form("Email")%></td>
</tr>
</table>
<%
Dim objMail
Set objMail = CreateObject("CDONTS.NewMail")
objMail.From = strFrom
objMail.To = strTo
objMail.Subject = "Overstock Confirmation"
StrMessage = strMessage & "Authorizing Person's Email - " &
Request.Form("Email") & vbCrLf
objMail.Body = strMessage
objMail.Send
Set objMail = nothing
%>
</form>
</body>
</html>

Both the second asp page and the email add a comma after the email
address that was entered in the field in the first asp page. Does any
one know how to get rid of it.

I'm a new web developer and have lots of books all over my desk. I've
check news groups, but I still can't seem to figure this one out. I'm
hoping it's a silly little mistake.



The problem is in this bit of code here:

-----------------------------------------------------
<td><input type="TEXT" name="Email" size="50"></td>
</tr>
</table>
<%
Response.Write ("<input type=hidden name=Email value=" &
request.querystring("Email") & ">")
-----------------------------------------------------

You have 2 form items with the same name... so your next page is showing
them as a collection.

IE: if on page 1 you had a form with:
<input type="text" name="color" value="red">
<input type="text" name="color" value="green">
<input type="text" name="color" value="blue">

and then on the second page you put in:

response.write request.form("color")

Your output would look like:
red, green, blue

and thats because "color" refers to 3 form items on the first page... and
thats your problem: you have 2 form items on the first page with the same
name: "Email"

As a side note: your code above uses CDONTS... you should, to save yourself
time and headaches in the future, start switching to CDO instead. The two
(CDO and CDONTS) are almost the same as far as sending out an email goes,
but the big difference is that CDONTS is no longer supported in Windows
Server 2003... so when your host eventually switches to Win2K3 (or you get a
new host) you don't end up with potentially a bunch of pages that need
converting to the new way of doing email from the server.
 
W

WebMaster

Richard said:
I trust you understand that VBscript will only work in IE??

it's an asp page, so it's serverside. Wich client you use is therefore
irrelevant...

Rudy
 
D

Duende

While sitting in a puddle Richard scribbled in the mud:
I trust you understand that VBscript will only work in IE??
i was going to use it myself until I found that out.
Why?
 
B

Beauregard T. Shagnasty

WebMaster said:
it's an asp page, so it's serverside. Wich client you use is
therefore irrelevant...

Richard only knows of PurloinedScript...
 
A

Andy Dingley

I trust you understand that VBscript will only work in IE??

It also runs on web servers running ASP.

<%@ Language="VBScript"%>

Is an ASP statement switching the language for the page into VBScript.

i was going to use it myself until I found that out.

That, and the fact that Basic is beyond you and you still haven't
written any code anyway, just copied it from others.


PS to the original poster. VBScript is horrible - use JavaScript
instead. Much better error trapping is just one good benefit you'll
see.
 
R

Richard

It also runs on web servers running ASP.
<%@ Language="VBScript"%>
Is an ASP statement switching the language for the page into VBScript.

See people? This is how areply should be, informative.

That, and the fact that Basic is beyond you and you still haven't
written any code anyway, just copied it from others.

Excuse me, sir, but I started off in computers writing BASIC codes.
Why should one take the time to write a duplicate of something that's
already been written?

PS to the original poster. VBScript is horrible - use JavaScript
instead. Much better error trapping is just one good benefit you'll
see.

What makes you think VBscript can't do error handling?
 
A

Andy Dingley

See people? This is how areply should be, informative.

Don't try flattering to get on my good side - I still think you're the
Jar Jar Binks of web design,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top