Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Software > Adobe Software > Dreamweaver

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-24-2008, 03:43 PM
Guperman
 
Posts: n/a
Re: Form to Mail PHP

Thanks Murray

Fortunately the server had an option of Windows and Linux platforms. I asked
them to move my site to the Windows platform, and my submission form worked.

Now I'm doing a site for a client who's with a server with a Linux platform
and I find myself with the same problem again. Below please find the php file I
use. On testing I do receive the email but a very empty email. Much appreciated.

<?php

/* subject and email variables */


$emailSubject = 'Reservation Day Trip with Jimmy Felix';
$to = '2005@stage.co.za';


/* Gathering Data Variables */


$nameField = $_POST['name'];
$peopleField = $_POST['people'];
$timeField = $_POST['time9am10am'];
$timeField2 = $_POST['time12am1pm'];
$timeField2 = $_POST['check'];


$body = "<<<EOD
<br><hr><br>

Name: $name <br>
People: $people <br>
Time: $time9am10am <br>
Time2: $time12am1pm <br>
TermsConditionsChecked: $check <br>

EOD";

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
ini_set("sendmail_from", "2005@stage.co.za");
$success = mail($to, $emailSubject, $body, $headers);



/* Results rendered as HTML */

$theResults = <<<EOD




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script src="SpryAssets/SpryEffects.js" type="text/javascript"></script>
<script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if
((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
location.reload();
}
MM_reloadPage(true);
function MM_effectHighlight(targetElement, duration, startColor, endColor,
restoreColor, toggle)
{
Spry.Effect.DoHighlight(targetElement, {duration: duration, from: startColor,
to: endColor, restoreColor: restoreColor, toggle: toggle});
}
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style2 {font-size: 85%}
-->
</style>
<link href="SpryAssets/SpryAccordion.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
-->
</style>
</head>

<body>
<div id="Container">
<div id="Header">
<div class="HeaderText"> <span class="dottedUnderline">st.thomas day
trips</span> </div></div>
<div id="MainContent">

<div id="menu">
<div class="menu">
<p><span onclick="MM_goToURL('parent','index.html');return
document.MM_returnValue"
onmouseover="MM_effectHighlight(this, 100, '#ffffff', '#DDE2E0', '#ffffff',
true)"> home ::</span></p>
<p><span onclick="MM_goToURL('parent','about.html');return
document.MM_returnValue"
onmouseover="MM_effectHighlight(this, 100, '#ffffff', '#dde2e0', '#ffffff',
true)">about ::</span></p>
<p><span onclick="MM_goToURL('parent','maps.html');return
document.MM_returnValue"
onmouseover="MM_effectHighlight(this, 100, '#ffffff', '#dde2e0', '#ffffff',
true)">maps ::</span></p>
<p><span onclick="MM_goToURL('parent','gallery.html');retur n
document.MM_returnValue" onmouseover="MM_effectHighlight(this, 100, '#ffffff',
'#dde2e0', '#ffffff', true)">gallery ::</span></p>
<p><span onclick="MM_goToURL('parent','reservations.html'); return
document.MM_returnValue" onmouseover="MM_effectHighlight(this, 100, '#ffffff',
'#dde2e0', '#ffffff', true)">reservations ::</span></p>
</div>
</div>
<br />
<div id="Accordion1" class="Accordion" tabindex="0">
<div class="AccordionPanel">
<div class="AccordionPanelTab">:: CONFIRMATION</div>
<div class="AccordionPanelContent">
<div id="MainContentP">
<h1 class="Headings">Thank you for your reservation!</h1>
We appreciate your business

<p>Your driver's name is <span class="emphasisRedBold">Jimmy
Felix</span>.</p>
<p>Don't forget your camera!</p>
<p>Lastly, don't forget to tell a friend about this tour - and the free
Rum Punch at the Rum Factory...</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><br />
</p>
</div>
</div>
</div>
<div class="AccordionPanel">
<div class="AccordionPanelTab">:: REMEMBER</div>
<div class="AccordionPanelContent">
<div id="MainContentP">

<h1 class="Headings">Don't feed the inguanas!</h1>
<div class="floatLeft">
<img src="images/inguana.jpg" /> </div>Although we treat our inguanas
like you treat your labradors, they are prehistoric creatures who don't digest
man made food well.<br /><br />
Besides, we won't go about feeding your labradors. It's not cool! <br
/><br />
But don't worry, where I take you there aren't many inguanas.

<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
</div>
</div>
</div>
</div>
<div id="Footer">Powered by gandor.tv</div>
<div id="Footer2"></div>

</div>

<script type="text/javascript">
<!--
var Accordion1 = new Spry.Widget.Accordion("Accordion1");
//-->
</script>
</body>
</html>

EOD;
echo "$theResults";

?>

Reply With Quote
  #2 (permalink)  
Old 07-24-2008, 05:43 PM
Gary White
 
Posts: n/a
Re: Form to Mail PHP

On Thu, 24 Jul 2008 15:43:40 +0000 (UTC), "Guperman"
<webforumsuser@macromedia.com> wrote:

> $body = "<<<EOD
> <br><hr><br>
>
> Name: $name <br>
> People: $people <br>
> Time: $time9am10am <br>
> Time2: $time12am1pm <br>
> TermsConditionsChecked: $check <br>
>
> EOD";


The above is wrong. Try it like this:

$body = <<<EOD
<br><hr><br>

Name: $name <br>
People: $people <br>
Time: $time9am10am <br>
Time2: $time12am1pm <br>
TermsConditionsChecked: $check <br>

EOD;

Gary
Reply With Quote
  #3 (permalink)  
Old 07-25-2008, 12:46 PM
Guperman
 
Posts: n/a
Re: Form to Mail PHP

Thanks Gary

My original script was as you suggested. Then I got advised to add the
quotation marks. I've changed it back to what it was but with no luck. Any
advice would be much appreciated. Might it be because the contact form is
within an Spry accordion?

<?php

/* subject and email variables */


$emailSubject = 'Reservation Day Trip with Jimmy Felix';
$to = 'gustav@stage.co.za';


/* Gathering Data Variables */


$nameField = $_POST['name'];
$peopleField = $_POST['people'];
$timeField = $_POST['time9am10am'];
$timeField2 = $_POST['time12am1pm'];
$timeField2 = $_POST['check'];


$body = <<<EOD
<br><hr><br>

Name: $name <br>
People: $people <br>
Time: $time9am10am <br>
Time2: $time12am1pm <br>
TermsConditionsChecked: $check <br>

EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
ini_set("sendmail_from", "gustav@stage.co.za");
$success = mail($to, $emailSubject, $body, $headers);



/* Results rendered as HTML */

$theResults = <<<EOD




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script src="SpryAssets/SpryEffects.js" type="text/javascript"></script>
<script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if
((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
location.reload();
}
MM_reloadPage(true);
function MM_effectHighlight(targetElement, duration, startColor, endColor,
restoreColor, toggle)
{
Spry.Effect.DoHighlight(targetElement, {duration: duration, from: startColor,
to: endColor, restoreColor: restoreColor, toggle: toggle});
}
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style2 {font-size: 85%}
-->
</style>
<link href="SpryAssets/SpryAccordion.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
-->
</style>
</head>

<body>
<div id="Container">
<div id="Header">
<div class="HeaderText"> <span class="dottedUnderline">st.thomas day
trips</span> </div></div>
<div id="MainContent">

<div id="menu">
<div class="menu">
<p><span onclick="MM_goToURL('parent','index.html');return
document.MM_returnValue"
onmouseover="MM_effectHighlight(this, 100, '#ffffff', '#DDE2E0', '#ffffff',
true)"> home ::</span></p>
<p><span onclick="MM_goToURL('parent','about.html');return
document.MM_returnValue"
onmouseover="MM_effectHighlight(this, 100, '#ffffff', '#dde2e0', '#ffffff',
true)">about ::</span></p>
<p><span onclick="MM_goToURL('parent','maps.html');return
document.MM_returnValue"
onmouseover="MM_effectHighlight(this, 100, '#ffffff', '#dde2e0', '#ffffff',
true)">maps ::</span></p>
<p><span onclick="MM_goToURL('parent','gallery.html');retur n
document.MM_returnValue" onmouseover="MM_effectHighlight(this, 100, '#ffffff',
'#dde2e0', '#ffffff', true)">gallery ::</span></p>
<p><span onclick="MM_goToURL('parent','reservations.html'); return
document.MM_returnValue" onmouseover="MM_effectHighlight(this, 100, '#ffffff',
'#dde2e0', '#ffffff', true)">reservations ::</span></p>
</div>
</div>
<br />
<div id="Accordion1" class="Accordion" tabindex="0">
<div class="AccordionPanel">
<div class="AccordionPanelTab">:: CONFIRMATION</div>
<div class="AccordionPanelContent">
<div id="MainContentP">
<h1 class="Headings">Thank you for your reservation!</h1>
We appreciate your business

<p>Your driver's name is <span class="emphasisRedBold">Jimmy
Felix</span>.</p>
<p>Don't forget your camera!</p>
<p>Lastly, don't forget to tell a friend about this tour - and the free
Rum Punch at the Rum Factory...</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><br />
</p>
</div>
</div>
</div>
<div class="AccordionPanel">
<div class="AccordionPanelTab">:: REMEMBER</div>
<div class="AccordionPanelContent">
<div id="MainContentP">

<h1 class="Headings">Don't feed the inguanas!</h1>
<div class="floatLeft">
<img src="images/inguana.jpg" /> </div>Although we treat our inguanas
like you treat your labradors, they are prehistoric creatures who don't digest
man made food well.<br /><br />
Besides, we won't go about feeding your labradors. It's not cool! <br
/><br />
But don't worry, where I take you there aren't many inguanas.

<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
</div>
</div>
</div>
</div>
<div id="Footer">Powered by gandor.tv</div>
<div id="Footer2"></div>

</div>

<script type="text/javascript">
<!--
var Accordion1 = new Spry.Widget.Accordion("Accordion1");
//-->
</script>
</body>
</html>

EOD;
echo "$theResults";

?>

Reply With Quote
  #4 (permalink)  
Old 07-26-2008, 10:20 AM
Gary White
 
Posts: n/a
Re: Form to Mail PHP

On Fri, 25 Jul 2008 12:46:01 +0000 (UTC), "Guperman"
<webforumsuser@macromedia.com> wrote:

> My original script was as you suggested. Then I got advised to add the
>quotation marks. I've changed it back to what it was but with no luck. Any
>advice would be much appreciated. Might it be because the contact form is
>within an Spry accordion?


What happens when you try it?

Gary
Reply With Quote
  #5 (permalink)  
Old 07-26-2008, 04:32 PM
Guperman
 
Posts: n/a
Re: Form to Mail PHP

Hi Gary

You asked me what happens if I send the form. When I send it I do receive an
email, but with no content. Like this:

From: <daytripv@host94.hostmonster.com>
Date: Sun, 20 Jul 2008 16:32:57 -0600
To: <myemailaddress>
Subject: (which is correct)

Name:
People:
Time:
Time2:
TermsConditionsChecked:

_________________

> My original script was as you suggested. Then I got advised to add the
>quotation marks. I've changed it back to what it was but with no luck. Any
>advice would be much appreciated. Might it be because the contact form is
>within an Spry accordion?


What happens when you try it?

Gary

Reply With Quote
  #6 (permalink)  
Old 07-27-2008, 10:18 AM
Gary White
 
Posts: n/a
Re: Form to Mail PHP

On Sat, 26 Jul 2008 16:32:08 +0000 (UTC), "Guperman"
<webforumsuser@macromedia.com> wrote:

> You asked me what happens if I send the form. When I send it I do receive an
>email, but with no content. Like this:


First, double check that the form's method is set to post, not get.
Then, for debugging purposes, Try this to see what the script is
seeing.

<?php

print "<pre>\n";
print_r($_POST);
exit("</pre>\n");

/* subject and email variables */

$emailSubject = 'Reservation Day Trip with Jimmy Felix';
$to = 'gustav@stage.co.za';

/* Gathering Data Variables */

Gary
Reply With Quote
  #7 (permalink)  
Old 07-28-2008, 05:10 PM
Guperman
 
Posts: n/a
Re: Form to Mail PHP

Gary wrote:
>First, double check that the form's method is set to post, not get.
>Then, for debugging purposes, Try this to see what the script is
>seeing.


<?php

print "<pre>\n";
print_r($_POST);
exit("</pre>\n");

Hi Gary. The following is what comes up when I click the submission button
after I have inserted the above script:

Array
(
[name] => test
[people] => 3
[arrival] => 5/3?08
[time] => between 12am-1pm
[cruiseship] => Liliship
[check] => Yes I\'ve read the terms and conditions
[submit] => Submit
)


Reply With Quote
  #8 (permalink)  
Old 07-28-2008, 09:50 PM
Gary White
 
Posts: n/a
Re: Form to Mail PHP

On Mon, 28 Jul 2008 17:10:37 +0000 (UTC), "Guperman"
<webforumsuser@macromedia.com> wrote:

> Array
> (
> [name] => test
> [people] => 3
> [arrival] => 5/3?08
> [time] => between 12am-1pm
> [cruiseship] => Liliship
> [check] => Yes I\'ve read the terms and conditions
> [submit] => Submit
> )


Okay. Here is your code from the form processing:

$nameField = $_POST['name'];
$peopleField = $_POST['people'];
$timeField = $_POST['time9am10am'];
$timeField2 = $_POST['time12am1pm'];
$timeField2 = $_POST['check'];


$body = <<<EOD
<br><hr><br>

Name: $name <br>
People: $people <br>
Time: $time9am10am <br>
Time2: $time12am1pm <br>
TermsConditionsChecked: $check <br>

EOD;


First, note the elements you're trying to use from the $_POST array
are:
name, people, time2am10am, time12am1pm, and check.

The actual form fields are:
name, people, time, cruiseship, and check.

Note also the variables you are assigning the form results to:

$nameField, $peopleField, $timeField, $timeField2, and (curiously)
$timeField2 again.

The variables you're putting into the message are:

$name, $people, $time8am10am, $time12am1pm and $check.

Try it this way:

$name = $_POST['name'];
$people = $_POST['people'];
$arrival = $_POST['arrival'];
$time = $_POST['time9am10am'];
$cruiseship = $_POST['cruiseship'];
$check = $_POST['check'];


$body = <<<EOD
<br><hr><br>

Name: $name <br>
People: $people <br>
Arrival: $arrival <br>
Time: $time <br>
Cruiseship: $cruiseship <br>
TermsConditionsChecked: $check <br>

EOD;

Gary
Reply With Quote
  #9 (permalink)  
Old 07-29-2008, 01:29 PM
Guperman
 
Posts: n/a
Re: Form to Mail PHP

Thank you very much Gary.

The way I originally had my PHP script worked well only if the server used the
Windows platform, but didn't work at all with my new server who uses Linux as
their platform.

Your suggestion makes it work 100% with the Linux platform.

Thank you kindly

G

Reply With Quote
  #10 (permalink)  
Old 07-29-2008, 05:33 PM
Gary White
 
Posts: n/a
Re: Form to Mail PHP

On Tue, 29 Jul 2008 13:29:46 +0000 (UTC), "Guperman"
<webforumsuser@macromedia.com> wrote:

>Thank you very much Gary.


You're welcome.


> The way I originally had my PHP script worked well only if the server used the
>Windows platform, but didn't work at all with my new server who uses Linux as
>their platform.


The difference isn't in the platform, Windows/Linux. The difference is
in renamed form fields and using incorrect variable names. That said,
I'm glad it's working for you now.

Gary
Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Software > Adobe Software > Dreamweaver


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:23 PM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109