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!

How to change URL of browser when submitting a form.

Status
Not open for further replies.

23kStudios

IS-IT--Management
Feb 9, 2005
13
US
I got a form going on...

When you push submit information is sent to an email address, and everything is fine.

I created a "submission successful page" @

But when you push submit it opens aspscript.asp (which queries all the information from the form @ sends to email - etc).

*** I need this to immidiately redirect to though. How can this be done?

I know the command is...

if Mailer.SendMail then
-But what could go here that will change the browsers URL immidiately??

Can anyone help me with this problem!

Also in the form.html (form) file itself the form action is..
<form action="aspscript.asp" method="post">

Maybe that has something to do with letting this happen?? Not sure... please help
 
Hey thanks man!!! That did work =)

One other question...

How do i add more than 1 recipient to recieve the information from the forum?

Mailer.AddRecipient "Mark", "Mark@23k.com"
That's what i have right now...

Do i simply do:
Mailer.AddRecipient "Mark", "Mark@23k.com; Tom, Tom@23k.com"

etc? Seperate with semi-colons or what?
 
Try this:

Mailer.AddRecipient "Mark", "Mark@23k.com"
Mailer.AddRecipient "John", "John@23k.com"
Mailer.AddRecipient "Tom", "Tom@23k.com"
Mailer.AddRecipient "Karl", "Karl@23k.com"


and so on...

-SecondToNone
 
Yeah i tried that right after i posted the question lol. I'm not too familiar with ASP =/

More of HTML/Javascript/CSS/C++ kind of guy.

Thanks dude!
 
No problem...we are all here to learn...

glad its working for you

-SecondToNone
 
Does netscape not understand ASP?
On netscape my page simply prints out all the ASP code... instead of showing it & changing to success.html.

What could be wrong with it, god i don't think i like ASP :p
 
i think you need additional components for cross browser support...

-SecondToNone
 
For ASP code to be processed, you need an .asp ending on the file names. Browsers are totally oblivious to ASP code because that's all processed on the server, and plain old HTML is spit out.

Lee
 
Maybe something was being done on the client side?
 
I mean of course the asp file is called aspscript.ASP ... its supposed to process the form, then it redirects to the wanted page.

<%
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "Vertex Campaign Brief"
Mailer.FromAddress= "Ryan@23k.com"
Mailer.RemoteHost = "mail.23k.com"
Mailer.AddRecipient "Ryan", "Ryan@23k.com"
Mailer.AddRecipient "Tom", "Tom@23k.com"
Mailer.AddRecipient "Kelly", "Kelly@23k.com"
Mailer.AddRecipient "Amy", "Amy@23k.com"
Mailer.AddRecipient "Mark", "Mark@23k.com"
Mailer.Subject = "Vertex campaign strategy brief form submission!"
strMsgHeader = "<strong><h2>Vertex Campaign Strategy Brief Information:</h2></strong>" & "-------------------------------------------------------<br><br>" & vbCrLf & vbCrLf & vbCrLf
for i = 1 to Request.Form.Count
strMsgInfo = strMsgInfo & "<b>" & Request.Form.Key(i) & "</b>" & ":<br>" & Request.Form.Item(i) & "<br><br>"
next
strMsgFooter = vbCrLf & vbCrLf & "*End of Form" & vbCrLf & "<br><a href=Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter
Mailer.ContentType = "text/html"
if Mailer.SendMail then
Response.Redirect "else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if
set Mailer = Nothing
%>

How do i allow for multi browser support? I want to make sure anyone using netscape won't have any problems with the page!
 
If you are using IIS 5.0/ASP3.0 or above, you should really use Server.Transfer("mypage.asp") to send the final page only (which will then display as a html page if written correctly).

REsponse.redirect sends the page that executes the command to the browser and adds a HTTP header to then redirect to the page that is on the server... in other words you goto the server, back to the client, back to the server, back to the client just to move to a different page.

Server.Transfer goes directly to the page and sends it back to the client in one step, reducing network traffic and server performance degradation.

You might also want to try just using the asp form that renders the mail output :

Code:
<%
Some ASP Stuff here

if bTheProcessFailed then
%>

<html>
<head>
<title>failure page</title>
</head>
<body>
 It failed !
 etc etc...
</body>
</html>

<% else %>

<html>
<head>
<title>success page</title>
</head>
<body>
 It worked!
 etc etc...
</body>
</html>

<% end if %>

But this may not be for you if you want to keep the files separate, just useful if you want to keep all the functionalities in one page - i.e. show the response/error codes from the function or use variables that are already in the ASP part of the page by simply including in the response buffer in the middle of the HTML - i.e.
Code:
 Your message: "<%=strMsgHeader%>" was sent succesfully

Hope that helps,
Damian


A smile is worth a thousand kind words. So smile, it's easy! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top