![]() |
|
|
|||
|
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> </p> <p> </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> </p> <p> </p> <p> </p> <p> </p> <p> </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"; ?> |
|
|||
|
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 |
|
|||
|
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> </p> <p> </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> </p> <p> </p> <p> </p> <p> </p> <p> </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"; ?> |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 ) |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|