thank you page

surreal5335

New Member
Messages
28
Reaction score
0
Points
0
I am in the process of creating an email submit button, I have my php code debugged, but I am trying to add a thank you page with a cookie attatched so as to thank the client by name entered in the name field.

I have the code JS for it here:

Code:
<title>Thank you for your submission</title>
<script type="text/javascript" language="JavaScript">

var Cookies = new Array(); // Leave this line as is.
function ReadCookieValues() {

var CookieName = "emailcookie";

var cookiecontent = '';
if(document.cookie.length > 0) {
   var cookiename = emailform + '=';
   var cookiebegin = document.cookie.indexOf(emailform);
   var cookieend = 0;
   if(cookiebegin > -1) {
      cookiebegin += cookiename.length;
      cookieend = document.cookie.indexOf(";",cookiebegin);
      if(cookieend < cookiebegin) { cookieend = document.cookie.length; }
      cookiecontent = document.cookie.substring(cookiebegin,cookieend);
      }
   }
if(cookiecontent.length < 0) { return; }
cookiecontent = unescape(cookiecontent);
Cookies = cookiecontent.split("\t\t");
}
ReadCookieValues();
function GetFieldValue(n) { 
for( var i = 0; i < Cookies.length; i++) { 
   var nv = Cookies[i].split("\t");
   if(nv[0] == n) {
      if(nv[1].length > 0) { return nv[1]; }
      else { return ''; }
      }
   }
return '';
}
function PrintPersonalizednfo() {
var otherwise = '';
var append = '';
if(arguments.length < 1) { return; }
if(arguments.length > 1) { otherwise = arguments[1]; }
if(arguments.length > 2) { append = arguments[2]; }
var v = GetFieldValue(arguments[0]);
if(v.length == 0) { v = otherwise; }
document.write(v+append);
}

//-->
</script>

<p>

<noscript>
Thank you for contacting me, I will get back to you as soon I am available
    </noscript>
I am also not sure where to put in the link to this thank you page on the email form:

Code:
[B]<img src="http://i95.photobucket.com/albums/l136/surreal5335/web%20builder/portfolioheader.png" hspace="10" vspace="10" align="center">[/B][B]<br/>[/B][B]<br>[/B]
[B][U]<form method="post" name="emailform" action="emailform.php">[/U][/B]
[B]<p class="legend">[/B]Contact via email[B]</p>[/B]
[B]<fieldset id="conact">[/B]
[B][U]<[I]label[/I]>[/U][/B]Name: [B][U]</[I]label[/I]>[/U][/B][B][U]<input type="text" name="name" size="30"/>[/U][/B][B]<br/>[/B]
[B]<br>[/B]
[B][U]<[I]label[/I]>[/U][/B]Email:  [B][U]</[I]label[/I]>[/U][/B][B][U]<input type="text" name="emailaddr1" size="30"/>[/U][/B][B]<br/>[/B]
[B]<br>[/B]
[B][U]<[I]label[/I]>[/U][/B]Email:  [B][U]</[I]label[/I]>[/U][/B][B][U]<input type="text" name="emailaddr2" size="30"/>[/U][/B][B]<br/>[/B]
[B]<br>[/B]
[B][U]<[I]label[/I]>[/U][/B]Phone: [B][U]</[I]label[/I]>[/U][/B][B][U]<input type="text" name="phone" size="30"/>[/U][/B][B]<br/>[/B]
[B]<br>[/B]
[B][U]<[I]label[/I]>[/U][/B]Comments: [B][U]</[I]label[/I]>[/U][/B][B]<br>[/B][B][U]<textarea name="comments" rows="10" cols="30">[/U][/B]Please give me a brief description of the work you need done[B][U]</textarea>[/U][/B][B]<br/>[/B]
[B]<br>[/B]
[B][U]<input type="submit" name="submit">[/U][/B][B][U]</button>[/U][/B][B]<br/>[/B]
Lastly if this is part of the issue here is the code for the first part of the cookie on the email form:

Code:
[B][B]<script type="text/javascript" language="JavaScript">[/B][/B]

//thank you page cookie
    [I]function[/I] CookieTheValues() {

    [I]var[/I] FormName = "emailform";
    [I]var[/I] CookieName = "emailcookie";
    [I]var[/I] cookiestring = [I]new[/I] Array();
    [I]var[/I] ilen = eval('[I]document[/I].emailform.length');
    [I]for[/I] (i = 0; i [B]< ilen; i++) { 
       [I]var[/I] n = eval('[I]document[/I].emailform.elements['+i+'].name');
       [I]if[/I](n.length == 0) { [I]continue[/I]; }
       [I]var[/I] fieldlen = eval('[I]document[/I].emailform.'+n+'.length');
       [I]if[/I](fieldlen >[/B] 0) { [I]continue[/I]; }
       [I]var[/I] v = eval('[I]document[/I].emailform.'+n+'.value');
       [I]if[/I](v.length == 0) { [I]continue[/I]; }
       v = escape(v);
       cookiestring.push(n + '%09' + v);
   }
    [I]document[/I].cookie = CookieName + '=' + cookiestring.join('%09%09') + '; path=/';
    [I]return[/I] [I]true[/I];
}

Thanks a lot for your help
 

VPmase

New Member
Messages
914
Reaction score
0
Points
0
Why don't you just have the thank you page on the PHP page? If the mail() is successful echo your thank you message, otherwise explain whats wrong.
 

surreal5335

New Member
Messages
28
Reaction score
0
Points
0
Thanks a lot for the info. If I were to just echo the thank you message (which is in html)
do I mearly type:

Code:
[B]	[U]echo[/U] [B]<html>[/B]
[B]<head>[/B]
[B]</head>[/B]
[B]<body>[/B]
[B]<table border="1" width="100%">[/B]
[B]<tr>[/B]
[B]<td width="10%">[/B]
[B]<map name="homeleft" id="homeleft" align="left">[/B]
[B]<area shape="rect" coords="10, 10, 212, 219" href="index.html"/>[/B]
[B]<area shape="rect" coords="66, 253, 168, 303" href="realestatepost.html"/>[/B]
[B]<area shape="rect" coords="66, 342, 168, 391" href="graphics.html"/>[/B]
[B]</map>[/B]

?>[/B]

The code does continue on but I dont think its relavent to the matter at hand.
I did try this and I got error message saying unexpected "<"
So how should it be done properly?
Thanks a lot
 

VPmase

New Member
Messages
914
Reaction score
0
Points
0
It would be something like this if you wanted to add the html and body tag:

PHP:
echo '<html>
<head>
</head>
<body>
<table border="1" width="100%">
<tr>
<td width="10%">
<map name="homeleft" id="homeleft" align="left">
<area shape="rect" coords="10, 10, 212, 219" href="index.html"/>
<area shape="rect" coords="66, 253, 168, 303" href="realestatepost.html"/>
<area shape="rect" coords="66, 342, 168, 391" href="graphics.html"/>
</map>
</td>
</tr>
</table>
</body>
</html>'
 

devongovett

New Member
Messages
33
Reaction score
0
Points
0
Or you could put that html in a separate file and call:
header( "Location: "mythankyoupage.html" );
 
Top