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

urgent help sending form results via email and redirecting to new page

Status
Not open for further replies.

devondago

Programmer
Jan 22, 2003
38
US
Can someone help me with this form script.. this is a form that the results are sent via email...I also want to redirect the user to a thank you page once they have completed the form...what do I need to add in order for this to be accomplished?
Please help!

<!---BUILD --->
<script language=&quot;JavaScript&quot;>
<!--
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf(&quot;?&quot;))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args);
if (val) { nm=val.name; if ((val=val.value)!=&quot;&quot;) {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') {
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>

<cfset #adminemail# = &quot;oasis@msn.com&quot;>

<cfparam name=&quot;action&quot; default=&quot;&quot;>

<cfif #adminemail# is &quot;&quot;>
<blockquote>
<strong>The destination e-mail address has not yet been configured.</strong>
</blockquote>
</cfif>

<cfif #action# is &quot;&quot;>


<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<table width=&quot;570&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td valign=&quot;top&quot; height=&quot;45&quot;>
<div align=&quot;right&quot;><img src=&quot;images/famb_banner.gif&quot; width=&quot;287&quot; height=&quot;26&quot; alt=&quot;Family at Family Test&quot;></div>
</td>
</tr>
<tr>
<td>
<div align=&quot;left&quot;><img src=&quot;images/req_info_subhead.gif&quot; width=&quot;259&quot; height=&quot;31&quot; alt=&quot;Request for Information&quot;></div>
</td>
</tr>
<tr>
<td><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>You
are welcome to take advantage of classes.</font>
<p><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>It
is necessary to register for all classes. Please call <b>(###) #######</b>
or complete the e-mail form below. We will contact you to discuss class
times and availability. <br>
We look forward to hearing from you!</font> </p>
</td>
</tr>

<cfoutput><form method=&quot;POST&quot; action=&quot;#thisscript#&action=send&quot;></cfoutput>

<table cellspacing = 0 cellpadding = 2 width=100%>
<tr>
<td colspan=2><b><font color=&quot;003399&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot;>Contact
Information </font></b></td>
</tr>
<tr>
<td align=right width=&quot;31%&quot;><font size=&quot;2&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; color=&quot;003399&quot;>Name:</font></td>
<td width=&quot;69%&quot;> <font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;text&quot; name=&quot;Name&quot; size = 30 >
</font></td>
</tr>
<tr>
<td align=right width=&quot;31%&quot;><font size=&quot;2&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; color=&quot;003399&quot;>E-mail
Address:</font></td>
<td width=&quot;69%&quot;> <font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;text&quot; name=&quot;Email&quot; size = 30 >
</font></td>
</tr>
<tr>
<td align=right width=&quot;31%&quot;><font size=&quot;2&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; color=&quot;003399&quot;>Street
Address:</font></td>
<td width=&quot;69%&quot;> <font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;text&quot; name=&quot;Address&quot; size = 30 >
</font></td>
</tr>
<tr>
<td align=right width=&quot;31%&quot;><font size=&quot;2&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; color=&quot;003399&quot;>City:</font></td>
<td width=&quot;69%&quot;> <font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;text&quot; name=&quot;City&quot; size = 30 >
</font></td>
</tr>
<tr>
<td align=right height=&quot;29&quot; width=&quot;31%&quot;><font size=&quot;2&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; color=&quot;003399&quot;>State:</font></td>
<td height=&quot;29&quot; width=&quot;69%&quot;> <font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;text&quot; name=&quot;State&quot; size = 2 >
</font></td>
</tr>
<tr>
<td align=right width=&quot;31%&quot;><font size=&quot;2&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; color=&quot;003399&quot;>Zip
Code:</font></td>
<td width=&quot;69%&quot;> <font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;text&quot; name=&quot;Zip&quot; size = 10 >
</font></td>
</tr>
<tr>
<td align=right width=&quot;31%&quot;><font size=&quot;2&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; color=&quot;003399&quot;>Telephone:</font></td>
<td width=&quot;69%&quot;><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
(
<input type=text name=&quot;PhoneA&quot; size = 3 >
) -
<input type=&quot;text&quot; name=&quot;PhoneB&quot; size = 8 >
</font></td>
</tr>
<tr>
<td height=&quot;22&quot;>
<div align=&quot;right&quot;><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>Due
Date:</font></div>
</td>
<td height=&quot;22&quot;><b><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;text&quot; name=&quot;date&quot; size=&quot;10&quot;>
</font></b></td>
</tr>
<tr>
<td colspan=2 height=&quot;22&quot;><b><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;></font></b></td>
</tr>
<tr>
<td colspan=2 height=&quot;22&quot;><b><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>Classes
you are interested in attending:</font></b></td>
</tr>
<tr>
<td colspan=&quot;2&quot;><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;a&quot; value=&quot;yes&quot;>
Care</font><b><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;></font></b></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;b&quot; value=&quot;yes&quot;>
Basics (for 11-13)</font></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;c&quot; value=&quot;yes&quot;>
Bootcamp </font></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;d&quot; value=&quot;yes&quot;>
feeding</font></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;e&quot; value=&quot;yes&quot;>
Birthdays</font></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;f&quot; value=&quot;yes&quot;>
Preparation</font></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;g&quot; value=&quot;yes&quot;>
Support</font></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;h&quot; value=&quot;yes&quot;>
Who Want More?</font></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;i&quot; value=&quot;yes&quot;>
Class 2</font></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;j&quot; value=&quot;yes&quot;>
Healthy </font></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;k&quot; value=&quot;yes&quot;>
Tours</font></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
CPR
<input type=&quot;checkbox&quot; name=&quot;l&quot; value=&quot;yes&quot;>
English
<input type=&quot;checkbox&quot; name=&quot;m&quot; value=&quot;yes&quot;>
Spanish</font></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;n&quot; value=&quot;yes&quot;>
Massage</font></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;o&quot; value=&quot;yes&quot;>
Support Group</font></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;p&quot; value=&quot;yes&quot;>
Planning 2</font></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;q&quot; value=&quot;yes&quot;>
Refresher</font></td>
</tr>
<tr>
<td colspan=2 height=&quot;23&quot;><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;r&quot; value=&quot;yes&quot;>
Sound</font></td>
</tr>
<tr>
<td colspan=2><font face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot; color=&quot;003399&quot;>
<input type=&quot;checkbox&quot; name=&quot;s&quot; value=&quot;yes&quot;>
Class 3(for 3-8)</font></td>
</tr>
<tr>
<td colspan=2 height=&quot;22&quot;> </td>
</tr>
</table>
<table cellspacing = 0 cellpadding = 2 width=100%>
<tr>
<td align=left colspan=2><b><font color=&quot;cc0000&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif, Geneva&quot; size=&quot;2&quot;>Your
Comments Are Welcome:</font></b></td>
</tr>
<tr>
<td colspan=2 align=center>
<div align=&quot;left&quot;>
<textarea cols=&quot;40&quot; rows=&quot;4&quot; name=&quot;Comments&quot;></textarea>
</div>
</td>
</tr>
</table>
<input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;submit&quot; onClick=&quot;MM_validateForm('Name','','R','Address','','R','City','','R','State','','R','Zip','','RisNum','PhoneA','','RisNum','PhoneB','','RisNum','Email','','NisEmail');return document.MM_returnValue&quot;>
<input type=&quot;reset&quot; value=&quot;Clear This Form&quot; name=&quot;reset&quot;>

<div align=center>
<p align=&quot;left&quot;> </p>
<p align=&quot;center&quot;>
</p>
<table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td><a href=&quot;#top&quot;><img src=&quot;images/Back_top.gif&quot; width=&quot;91&quot; height=&quot;9&quot; border=&quot;0&quot; alt=&quot;Back to Top&quot;></a></td>
</tr>
</table>
</form>
</div>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>

</cfif>

<cfif #action# is &quot;send&quot; and #adminemail# is not &quot;&quot;>

<cfparam name=&quot;a&quot; default=&quot;&quot;>
<cfparam name=&quot;b&quot; default=&quot;&quot;>
<cfparam name=&quot;c&quot; default=&quot;&quot;>
<cfparam name=&quot;d&quot; default=&quot;&quot;>
<cfparam name=&quot;e&quot; default=&quot;&quot;>
<cfparam name=&quot;f&quot; default=&quot;&quot;>
<cfparam name=&quot;g&quot; default=&quot;&quot;>
<cfparam name=&quot;h&quot; default=&quot;&quot;>
<cfparam name=&quot;i&quot; default=&quot;&quot;>
<cfparam name=&quot;j&quot; default=&quot;&quot;>
<cfparam name=&quot;k&quot; default=&quot;&quot;>
<cfparam name=&quot;l&quot; default=&quot;&quot;>
<cfparam name=&quot;m&quot; default=&quot;&quot;>
<cfparam name=&quot;n&quot; default=&quot;&quot;>
<cfparam name=&quot;o&quot; default=&quot;&quot;>
<cfparam name=&quot;p&quot; default=&quot;&quot;>
<cfparam name=&quot;q&quot; default=&quot;&quot;>
<cfparam name=&quot;r&quot; default=&quot;&quot;>
<cfparam name=&quot;s&quot; default=&quot;&quot;>



<cfmail to=&quot;#adminemail#&quot; from=&quot;#email#&quot; subject=&quot;Request &quot;>
The following person is interested in obtaining information for the Classes:

NAME: #Name#
EMAIL ADDRESS: #Email#
STREET ADDRESS: #Address#
CITY, STATE, ZIP: #City#, #State# #Zip#
TELEPHONE NUMBER: #PhoneA# #PhoneNumber#
DUE DATE: #DATE#


CLASSES YOU ARE INTERESTED IN::
<cfif #a# IS 'YES' >Care </cfif>
<cfif #b# IS 'YES' >Basics (for 11-13) </cfif>
<cfif #c# IS 'YES' >Bootcamp </cfif>
<cfif #d# IS 'YES' >feeding</cfif>
<cfif #e# IS 'YES' >Birth </cfif>
<cfif #f# IS 'YES' >Preparation </cfif>
<cfif #g# IS 'YES' >Support </cfif>
<cfif #h# IS 'YES' >Want More </cfif>
<cfif #i# IS 'YES' >Class</cfif>
<cfif #j# IS 'YES' >Healthy </cfif>
<cfif #k# IS 'YES' >CPR</cfif>
<cfif #l# IS 'YES' >English</cfif>
<cfif #m# IS 'YES' >Spanish</cfif>
<cfif #n# IS 'YES' >Massage</cfif>
<cfif #o# IS 'YES' >Support Group</cfif>
<cfif #p# IS 'YES' >Planning</cfif>
<cfif #q# IS 'YES' >Preparation</cfif>
<cfif #r# IS 'YES' >Safe and Sound</cfif>
<cfif #s# IS 'YES' >Class (for 3-8)</cfif>


INQUIRY/COMMENTS:
#Comments#

</cfmail>

<p align=&quot;center&quot;><img src=&quot;../images/famb_banner.gif&quot; alt=&quot;TBA&quot; width=&quot;287&quot; height=&quot;26&quot; border=&quot;0&quot;></p>
<font face=&quot;verdana&quot; size = &quot;2&quot; color=&quot;00308F&quot;>Thank you for your interest in </font>
<blockquote> </blockquote>
</cfif>






















 
Hi mate,

Don't take this the wrong way but you are stretching the use of these forums to your advantage.

We are here to help with specific items and errors etc, but certainly not to do what you want.

If you tell us the problems that you are having or specific errors that you are getting then people will be more than willing to help you.

These forums are a knowledgebase, not free technical support where we will debug your code for you and then write the rest of it.

Hope this helps Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
Thanks for the thought..but base on your profile and the type of questions you have asked we both have been in similar scenarios...If you would be so kind and help as I do in this forum it would be appreciated....
 
Please elaborate on your comments.

My profile currently says:

Threads I've Started: 63
Replies In My Own Threads: 198
Replies To Other Members' Threads: 2108

Now please explain to me where that is even slightly similar to anything in your situation? And also where any of my questions are even slightly related?

My questions that I have asked in the past (Which are few are far between) are not posting a full page of code and not explaining anything about specific details of what I am trying to do and where the errors are.

Hope this helps

Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
Prior to your last <cfif> add a <cflocation URL=&quot;template.cfm&quot;>. This way if the mail code runs the redirect will happen at the end of processing.

Otherwise you have not specified any other detail as to what exactly you need help with. DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
&quot;what do I need to add in order for this to be accomplished&quot;? To redirect to another page?

Look up <CFLOCATION> in the docs.

As an alternative, you could probably make do with a simple META refresh with a sufficient enough delay that you could assure the mail was sent. CFLOCATION would definitely be the most reliable, though.
Hope it helps,
-Carl
 
Thanks for the help! I got my form to work. I really do appreciate all your help in this. I hope I can repay the same way....! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top