PDA

View Full Version : Problem with form going to thank you page



jaybird84404
13 Jan 2010, 04:31 PM
I have a form set up that will email me the data and everything, but for some reason I cannot get the form to send people to the "thanks.asp page when they hit the submit button. The form data will still be emailed to me, but I cannot get it to redirect them yo the thanks page. Any help would be greatly appreciated.


<html>
<head>
<title>Congratulations on 30 years at WSU</title>
<script>
function ShowMenu(num, menu, max)
{
//num is selected value, menu is the name of the div, max is the number of divs
for(i = 1; i <= max; i++){
//add number onto end of menu
var menu_div = menu + i;

//if current show
if(i == num) {
document.getElementById(menu_div).style.display = 'block';
} else {
//if not, hide
document.getElementById(menu_div).style.display = 'none';
}
}



}
function MM_validateForm() { //v4.0
if (document.getElementById){
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=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
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') { num = parseFloat(val);
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 (num<min || max<num) 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>

<%
if Request.Form("isSubmitted") = "yes" then
Dim Name, Email, Phone, Item, officenumber, mailcode, street, city, state, zipcode
name = Request.Form("Name")
email = Request.Form ("Email")
phone = Request.Form("Phone")
item = Request.Form("Item")
officenumber = Request.Form("officenumber")
mailcode = Request.Form("mailcode")
street = Request.Form("street")
city = Request.Form("city")
state = Request.Form("state")
zipcode = Request.Form("zipcode")

Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.From = "bookstore@weber.edu"
objCDO.To = "jaymitchell@weber.edu"
objCDO.Subject = "Service Award Order"
objCDO.Body = "Name: " & Name & vbcrlf&_
"Email Address: " & Email & vbcrlf&_
"Phone: " & Phone & vbcrlf&_
"Item: " & Item & vbcrlf&_
"Office Number: " & officenumber & vbcrlf&_
"Mail Code: " & mailcode & vbcrlf&_
"Street: " & street & vbcrlf&_
"City: " & city & vbcrlf&_
"State: " & state & vbcrlf&_
"Zip Code: " & zipcode
objCDO.BodyFormat = 1
objCDO.MailFormat = 1
objCDO.Send

ConfirmMsg = "Thank you for submitting your order!"
end if %>


<%
if Request.Form("isSubmitted") = "yes" then
Response.Redirect "http://bookstore.weber.edu/thanks.asp"
end if
%>




<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><style type="text/css">
<!--
body {
background-image: url(images/Years-of-Service-WebOrder-Page-500.jpg);
background-repeat: no-repeat;
width: 765px;
max-width: 765px;
}
.style4 {font-weight: bold}
.style5 {
font-size: 12px;
font-weight: bold;
}
.style7 {font-size: smaller}
.style8 {font-weight: bold; font-size: smaller; }
-->
</style></head>

<br/><br/><br/><br/><br/><br/><br/>
<% if ConfirmMsg <> "" then %>

<h2><%= ConfirmMsg %></h2>

<% end if %>
<form width="750">
<form action="/jaystest.asp" method="post" enctype="multipart/form-data">
<p>Please, complete all the information. </p>
<p>Name (First and Last):
<input name="Name" type="text" id="Name" size="32">
<br>
Email Address:
<input name="Email" type="text" id="Email" size="36">
<br>
Phone number or campus extension:
<input name="Phone" type="text" id="Phone" size="20">
<br>
Gift Item #:
<input name="Item" type="text" id="Item" size="20">
<br>
<br>
Choose your preferred method of delivery:
<br>
<select id='deliverymethod'
onChange="javascript: ShowMenu(document.getElementById('deliverymethod').value,'divColor', 6);">
<option value='0'>Please select one
<option value='1'>Pick-up at bookstore
<option value='2'>Deliver to my office
<option value='3'>Deliver to my home
</select>
</p>
<div id='divColor1' style="display: none;"></div>

<div id='divColor2' style="display: none;">
<br>Office Number: <input name="officenumber" type="text" value="" size="5"><br>
Mail Code: <input name="mailcode" type="text" value="" size="9"><br>
</div>

<div id='divColor3' style="display: none;">
<br>Street Address: <input name="street" type="text" value="" size="40"><br>
City: <input type="text" name="city" value="">
State: <input name="state" type="text" value="" size="2" maxlength="2"><br>
Zip Code: <input name="zipcode" type="text" id="zipcode" value="" size="5" maxlength="5">
<br>
</div>
<p>
<input name="isSubmitted" type="hidden" value="yes">
<br>
Your gift will be available in 4-6 weeks.
<br>
<br>
<input type="submit" onClick="MM_validateForm('Name','','R','Email','','RisEmail','zipcode','','NisNum');MM_validateForm('Name','' ,'R','Email','','RisEmail','Phone','','R');MM_validateForm('Name','','R','Email','','RisEmail','Phon e','','R','Item','','R','zipcode','','NisNum');return document.MM_returnValue" value=" Submit my Order " action="thanks.asp">
</p>
<p> <br>
</p>
</form>

<br>
<br>
<br>