11 Replies Latest reply: Aug 29, 2012 11:36 AM by Tahoe Systems RSS

    PHP Form mailer script problem.. Please help!

    Tahoe Systems Community Member

      Hello everyone!

       

      Thank you in advance for taking a look at this post for me.

       

      --------------->   I am fairly new, designing my second website ever... I have stepped up to a bit more 'complex' form in my second website, that is designed to "request a quote" for a commercial appraisal. I have set up the  form and it seems to work just fine. But my problem is getting the php script to work with the form redirecting the user to the thankyou.html page on my site. Also, I am actually recieving the email with all the correct information, but the script just won't redirect the user to the thankyou page.

       

      This is the error I get after hitting the submit button in a browser:

       

       

      THE ERROR

       

       

      Warning: file_get_contents(blockip.txt) [function.file-get-contents]: failed to open stream: No such file or directory in /home/content/85/9643885/html/root_je/php/form2mail.php on line 50


      Deprecated: Function ereg_replace() is deprecated in /home/content/85/9643885/html/root_je/php/form2mail.php on line 111


      Warning: Cannot modify header information - headers already sent by (output started at /home/content/85/9643885/html/root_je/php/form2mail.php:50) in /home/content/85/9643885/html/root_je/php/form2mail.php on line 136

       

       

       

      THE PHP SCRIPT

       

      -------------->   I am using a free script from the web that I found, I have tried several, but this one has shown the best results so far: It's called form2mail.php and the script reads:***********

       

       

       

       

      <?php

      # You can use this script to submit your forms or to receive orders by email.

      $MailToAddress = "jim@jeurmston.com"; // your email address

      $redirectURL = "http://www.jeurmston.com/thankyou.html"; // the URL of the thank you page.

      $MailSubject = "[Website form message]"; // the subject of the email

      $sendHTML = FALSE; //set to "false" to receive Plain TEXT e-mail

      $serverCheck = TRUE; // if, for some reason you can't send e-mails, set this to "false"

       

       

      # copyright 2006 Web4Future.com =================== READ THIS ===================================================

       

       

      # If you are asking for a name and an email address in your form, you can name the input fields "name" and "email".

      # If you do this, the message will apear to come from that email address and you can simply click the reply button to answer it.

       

       

      # To block an IP, simply add it to the blockip.txt text file.

      # CHMOD 777 the blockip.txt file (run "CHMOD 777 blockip.txt", without the double quotes)

      # This is needed because the script tries to block the IP that tried to hack it

       

       

      # If you have a multiple selection box or multiple checkboxes, you MUST name the multiple list box or checkbox as "name[]" instead of just "name"

      # you must also add "multiple" at the end of the tag like this: <select name="myselectname[]" multiple>

      # you have to do the same with checkboxes

       

       

      /*****************************************************************

       

       

                Web4Future Easiest Form2Mail (GPL).

                Copyright (C) 1998-2006 Web4Future.com All Rights Reserved.

                http://www.Web4Future.com/

                This script was written by George L. & Calin S. from Web4Future.com

       

       

                This program is free software; you can redistribute it and/or modify

                it under the terms of the GNU General Public License as published by

                the Free Software Foundation; either version 2 of the License, or

                (at your option) any later version.

       

       

                This program is distributed in the hope that it will be useful,

                but WITHOUT ANY WARRANTY; without even the implied warranty of

                MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

                GNU General Public License for more details.

       

       

      *****************************************************************/

       

       

      # DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING ===================================================

      $w4fver =  "2.2";

      $ip = ($_SERVER['HTTP_X_FORWARDED_FOR'] == "" ? $_SERVER['REMOTE_ADDR'] : $_SERVER['HTTP_X_FORWARDED_FOR']);

      //function blockIP

      function blockip($ip) {

                $handle = @fopen("blockip.txt", 'a');

                @fwrite($handle, $ip."\n");

                @fclose($handle);

      }

      $w4fx = stristr(file_get_contents('blockip.txt'),getenv('REMOTE_ADDR'));

      if ($serverCheck) {

                if (preg_match ("/".str_replace("www.", "", $_SERVER["SERVER_NAME"])."/i", $_SERVER["HTTP_REFERER"])) { $w4fy = TRUE; } else { $w4fy = FALSE; }

      } else { $w4fy = TRUE; }

      if (($w4fy === TRUE) && ($w4fx === FALSE)) {

      $w4fMessage = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html>\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head><body><font face=3Dverdana size=3D2>";

      if (count($_GET) >0) {

                reset($_GET);

                while(list($key, $val) = each($_GET)) {

                          $GLOBALS[$key] = $val;

                          if (is_array($val)) {

                                    $w4fMessage .= "<b>$key:</b> ";

                                    foreach ($val as $vala) {

                                              $vala =stripslashes($vala);

                                              $vala = htmlspecialchars($vala);

                                              if (trim($vala)) { if (stristr($vala,"Content-Type:") || stristr($vala,"MIME-Version") || stristr($vala,"Content-Transfer-Encoding") || stristr($vala,"bcc:")) { blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); }          }

                                              $w4fMessage .= "$vala, ";

                                    }

                                    $w4fMessage .= "<br>\n";

                          }

                          else {

                                    $val = stripslashes($val);

                                    if (trim($val)) { if (stristr($val,"Content-Type:") || stristr($val,"MIME-Version") || stristr($val,"Content-Transfer-Encoding") || stristr($val,"bcc:")) { blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); }          }

                                    if (($key == "Submit") || ($key == "submit")) { }

                                    else {           if ($val == "") { $w4fMessage .= "$key: - <br>\n"; }

                                                        else { $w4fMessage .= "<b>$key:</b> $val<br>\n"; }

                                    }

                          }

                } // end while

      }//end if

      else {

                reset($_POST);

                while(list($key, $val) = each($_POST)) {

                          $GLOBALS[$key] = $val;

                          if (is_array($val)) {

                                    $w4fMessage .= "<b>$key:</b> ";

                                    foreach ($val as $vala) {

                                              $vala =stripslashes($vala);

                                              $vala = htmlspecialchars($vala);

                                              if (trim($vala)) { if (stristr($vala,"Content-Type:") || stristr($vala,"MIME-Version") || stristr($vala,"Content-Transfer-Encoding") || stristr($vala,"bcc:")) {blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); }          }

                                              $w4fMessage .= "$vala, ";

                                    }

                                    $w4fMessage .= "<br>\n";

                          }

                          else {

                                    $val = stripslashes($val);

                                    if (trim($val)) { if (stristr($val,"Content-Type:") || stristr($val,"MIME-Version") || stristr($val,"Content-Transfer-Encoding") || stristr($val,"bcc:")) {blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); }          }

                                    if (($key == "Submit") || ($key == "submit")) { }

                                    else {           if ($val == "") { $w4fMessage .= "$key: - <br>\n"; }

                                                        else { $w4fMessage .= "<b>$key:</b> $val<br>\n"; }

                                    }

                          }

                } // end while

                }//end else

                $w4fMessage .= "<font size=3D1><br><br>\n Sender IP: ".$ip."</font></font></body></html>";

          $w4f_what = array("/To:/i", "/Cc:/i", "/Bcc:/i","/Content-Type:/i","/\n/");

                $name = preg_replace($w4f_what, "", $name);

                $email = preg_replace($w4f_what, "", $email);

      if (!$email) {$email = $MailToAddress;}

                $mailHeader = "From: $name <$email>\r\n";

                $mailHeader .= "Reply-To: $name <$email>\r\n";

                $mailHeader .= "Message-ID: <". md5(rand()."".time()) ."@". ereg_replace("www.","",$_SERVER["SERVER_NAME"]) .">\r\n";

                $mailHeader .= "MIME-Version: 1.0\r\n";

                if ($sendHTML) {

                          $mailHeader .= "Content-Type: multipart/alternative;";

                          $mailHeader .= "           boundary=\"----=_NextPart_000_000E_01C5256B.0AEFE730\"\r\n";

                }

                $mailHeader .= "X-Priority: 3\r\n";

                $mailHeader .= "X-Mailer: PHP/" . phpversion()."\r\n";

                $mailHeader .= "X-MimeOLE: Produced By Web4Future Easiest Form2Mail $w4fver\r\n";

                if ($sendHTML) {

                          $mailMessage = "This is a multi-part message in MIME format.\r\n\r\n";

                          $mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730\r\n";

                          $mailMessage .= "Content-Type: text/plain;   charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";

                          $mailMessage .= trim(strip_tags($w4fMessage))."\r\n\r\n";

                          $mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730\r\n";

                          $mailMessage .= "Content-Type: text/html;   charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";

                          $mailMessage .= "$w4fMessage\r\n\r\n";

                          $mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730--\r\n";

                }

                if ($sendHTML === FALSE) {

                          $mailHeader .= "Content-Type: text/plain;   charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";

                          $mailMessage .= trim(strip_tags($w4fMessage))."\r\n\r\n";

                }

       

       

                if (!mail($MailToAddress, $MailSubject, $mailMessage,$mailHeader)) { echo "Error sending e-mail!";}

                else { header("Location: ".$redirectURL); }

      } else { echo "<center><font face=verdana size=3 color=red><b>ILLEGAL EXECUTION DETECTED!</b></font></center>";}

      ?>

       

         

      <?php

      # You can use this script to submit your forms or to receive orders by email.

      $MailToAddress = "jim@jeurmston.com"; // your email address

      $redirectURL = "http://www.jeurmston.com/thankyou.html"; // the URL of the thank you page.

      $MailSubject = "[Website form message]"; // the subject of the email

      $sendHTML = FALSE; //set to "false" to receive Plain TEXT e-mail

      $serverCheck = TRUE; // if, for some reason you can't send e-mails, set this to "false"

       

       

      # copyright 2006 Web4Future.com =================== READ THIS ===================================================

       

       

      # If you are asking for a name and an email address in your form, you can name the input fields "name" and "email".

      # If you do this, the message will apear to come from that email address and you can simply click the reply button to answer it.

       

       

      # To block an IP, simply add it to the blockip.txt text file.

      # CHMOD 777 the blockip.txt file (run "CHMOD 777 blockip.txt", without the double quotes)

      # This is needed because the script tries to block the IP that tried to hack it

       

       

      # If you have a multiple selection box or multiple checkboxes, you MUST name the multiple list box or checkbox as "name[]" instead of just "name"

      # you must also add "multiple" at the end of the tag like this: <select name="myselectname[]" multiple>

      # you have to do the same with checkboxes

       

       

                Web4Future Easiest Form2Mail (GPL).

                Copyright (C) 1998-2006 Web4Future.com All Rights Reserved.

                http://www.Web4Future.com/

                This script was written by George L. & Calin S. from Web4Future.com

       

       

                This program is free software; you can redistribute it and/or modify

                it under the terms of the GNU General Public License as published by

                the Free Software Foundation; either version 2 of the License, or

                (at your option) any later version.

       

       

                This program is distributed in the hope that it will be useful,

                but WITHOUT ANY WARRANTY; without even the implied warranty of

                MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

                GNU General Public License for more details.

       

       

       

      # DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING ===================================================

      $w4fver =  "2.2";

      $ip = ($_SERVER['HTTP_X_FORWARDED_FOR'] == "" ? $_SERVER['REMOTE_ADDR'] : $_SERVER['HTTP_X_FORWARDED_FOR']);

      //function blockIP

      function blockip($ip) {

                $handle = @fopen("blockip.txt", 'a');

                @fwrite($handle, $ip."\n");

                @fclose($handle);

      }

      $w4fx = stristr(file_get_contents('blockip.txt'),getenv('REMOTE_ADDR'));

      if ($serverCheck) {

                if (preg_match ("/".str_replace("www.", "", $_SERVER["SERVER_NAME"])."/i", $_SERVER["HTTP_REFERER"])) { $w4fy = TRUE; } else { $w4fy = FALSE; }

      } else { $w4fy = TRUE; }

      if (($w4fy === TRUE) && ($w4fx === FALSE)) {

      $w4fMessage = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html>\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head><body><font face=3Dverdana size=3D2>";

      if (count($_GET) >0) {

                reset($_GET);

                while(list($key, $val) = each($_GET)) {

                          $GLOBALS[$key] = $val;

                          if (is_array($val)) {

                                    $w4fMessage .= "<b>$key:</b> ";

                                    foreach ($val as $vala) {

                                              $vala =stripslashes($vala);

                                              $vala = htmlspecialchars($vala);

                                              if (trim($vala)) { if (stristr($vala,"Content-Type:") || stristr($vala,"MIME-Version") || stristr($vala,"Content-Transfer-Encoding") || stristr($vala,"bcc:")) { blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); }          }

                                              $w4fMessage .= "$vala, ";

                                    }

                                    $w4fMessage .= "<br>\n";

                          }

                          else {

                                    $val = stripslashes($val);

                                    if (trim($val)) { if (stristr($val,"Content-Type:") || stristr($val,"MIME-Version") || stristr($val,"Content-Transfer-Encoding") || stristr($val,"bcc:")) { blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); }          }

                                    if (($key == "Submit") || ($key == "submit")) { }

                                    else {           if ($val == "") { $w4fMessage .= "$key: - <br>\n"; }

                                                        else { $w4fMessage .= "<b>$key:</b> $val<br>\n"; }

                                    }

                          }

                } // end while

      }//end if

      else {

                reset($_POST);

                while(list($key, $val) = each($_POST)) {

                          $GLOBALS[$key] = $val;

                          if (is_array($val)) {

                                    $w4fMessage .= "<b>$key:</b> ";

                                    foreach ($val as $vala) {

                                              $vala =stripslashes($vala);

                                              $vala = htmlspecialchars($vala);

                                              if (trim($vala)) { if (stristr($vala,"Content-Type:") || stristr($vala,"MIME-Version") || stristr($vala,"Content-Transfer-Encoding") || stristr($vala,"bcc:")) {blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); }          }

                                              $w4fMessage .= "$vala, ";

                                    }

                                    $w4fMessage .= "<br>\n";

                          }

                          else {

                                    $val = stripslashes($val);

                                    if (trim($val)) { if (stristr($val,"Content-Type:") || stristr($val,"MIME-Version") || stristr($val,"Content-Transfer-Encoding") || stristr($val,"bcc:")) {blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); }          }

                                    if (($key == "Submit") || ($key == "submit")) { }

                                    else {           if ($val == "") { $w4fMessage .= "$key: - <br>\n"; }

                                                        else { $w4fMessage .= "<b>$key:</b> $val<br>\n"; }

                                    }

                          }

                } // end while

                }//end else

                $w4fMessage .= "<font size=3D1><br><br>\n Sender IP: ".$ip."</font></font></body></html>";

          $w4f_what = array("/To:/i", "/Cc:/i", "/Bcc:/i","/Content-Type:/i","/\n/");

                $name = preg_replace($w4f_what, "", $name);

                $email = preg_replace($w4f_what, "", $email);

      if (!$email) {$email = $MailToAddress;}

                $mailHeader = "From: $name <$email>\r\n";

                $mailHeader .= "Reply-To: $name <$email>\r\n";

                $mailHeader .= "Message-ID: <". md5(rand()."".time()) ."@". ereg_replace("www.","",$_SERVER["SERVER_NAME"]) .">\r\n";

                $mailHeader .= "MIME-Version: 1.0\r\n";

                if ($sendHTML) {

                          $mailHeader .= "Content-Type: multipart/alternative;";

                          $mailHeader .= "           boundary=\"----=_NextPart_000_000E_01C5256B.0AEFE730\"\r\n";

                }

                $mailHeader .= "X-Priority: 3\r\n";

                $mailHeader .= "X-Mailer: PHP/" . phpversion()."\r\n";

                $mailHeader .= "X-MimeOLE: Produced By Web4Future Easiest Form2Mail $w4fver\r\n";

                if ($sendHTML) {

                          $mailMessage = "This is a multi-part message in MIME format.\r\n\r\n";

                          $mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730\r\n";

                          $mailMessage .= "Content-Type: text/plain;   charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";

                          $mailMessage .= trim(strip_tags($w4fMessage))."\r\n\r\n";

                          $mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730\r\n";

                          $mailMessage .= "Content-Type: text/html;   charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";

                          $mailMessage .= "$w4fMessage\r\n\r\n";

                          $mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730--\r\n";

                }

                if ($sendHTML === FALSE) {

                          $mailHeader .= "Content-Type: text/plain;   charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";

                          $mailMessage .= trim(strip_tags($w4fMessage))."\r\n\r\n";

                }

       

       

                if (!mail($MailToAddress, $MailSubject, $mailMessage,$mailHeader)) { echo "Error sending e-mail!";}

                else { header("Location: ".$redirectURL); }

      } else { echo "<center><font face=verdana size=3 color=red><b>ILLEGAL EXECUTION DETECTED!</b></font></center>";}

      ?>

       

       

       

       

      THE HTML FORM

       

      ------------------> And finally here is my html FORM page request_quote.html:*************************

       

       

       

       

       

      <!DOCTYPE HTML><html><!-- InstanceBegin template="/Templates/je_fullwidth.dwt" codeOutsideHTMLIsLocked="false" -->

       

       

      <head>

                <script type="text/javascript" src="js/jquery.js"></script>

       

          <link href="css/styles.css" rel="stylesheet" type="text/css" media="screen">

       

       

          <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

                <meta http-equiv="Content-Type" content="cache" />

                <meta name="robots" content="INDEX,FOLLOW" />

                <meta name="keywords" content="Enter Keywords" />

                <meta name="description" content="Description Here" />

      <!-- InstanceBeginEditable name="doctitle" -->

                <title>J.E. Urmston Request A Quote Page</title>

         

                                    <script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(d ocument.documentElement)</script>

                            <link href="css/validate.css" type="text/css" rel="stylesheet" media="screen,projection" />

                 

                            <script type="text/javascript" src="js/validate.js"></script>

                 

                                     <script type="text/javascript">

                      $(document).ready(function() {

                          $('form.required-form').simpleValidate({

                              errorElement: 'em'

                          });

                      });

                  </script>

         

                <!-- InstanceEndEditable -->

                <!-- Google Analytics Code Goes Below Here -->

             

         

          <!-- End Google Analytics Code -->

      <!-- InstanceBeginEditable name="head" -->

      <!-- InstanceEndEditable -->

      </head>

       

       

      <body>

       

       

      <div id="outer">

       

       

      <div id="wrapper">

       

                          <div id="logo">

                                    <img src="images/logos/logo_1.jpg" />

                          </div>

       

                          <div id="social-media-icons">

                        <ul>

                            <li><a href="http://www.facebook.com" target="_blank"><img src="images/icons/facebook_32.jpg" alt="Facebook Link" /></a></li>

                    <li><a href="http://www.twitter.com" target="_blank"><img src="images/icons/twitter_32.jpg" alt="Twitter Link" /></a></li>

                    <li><a href="mailto:jeurmston@charter.net"><img src="images/icons/email_32.jpg" alt="Email Link" /></a></li>

                  </ul>

       

                          </div>

       

       

                          <div id="topnav">

                                    <ul>

                            <li><a href="index.html">HOME</a></li>

                      <li><a href="about.html">ABOUT</a></li>

                      <li><a href="services.html">SERVICES</a></li>

                      <li><a href="gallery.html">GALLERY</a></li>

                      <li><a href="contact.html">CONTACT US</a></li>

                  </ul>     

       

                          </div>

       

                          <div id="banner">

                        <img src="images/banner/reno1.jpg" alt="Banner image of Reno, NV at night" />

       

                          </div>

       

              <div id="content-fullwidth"><!-- InstanceBeginEditable name="content" -->

                          <div id="form-wrapper">

                            <h1>Request a Quote</h1>

                            <p>Lorem pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>

                   

                    <form class="required-form" action="php/form2mail.php" method="post">

                     <input type="hidden" name="redirect" value="thankyou.html" />              

                      <ol class="forms">

                         

                          <li>

                            <label for="name"> Name of Property:</label>

                            <input type="text" name="name" id="name" />

                          </li>

                         

                          <li>

                            <label for="company"> Name of Company/Owner:</label>

                            <input type="text" name="company" id="company" />

                          </li>

                        

                          <li>

                            <label for="address1"><em class="required">*</em> Address / APN #:</label>

                            <input type="text" name="address1" id="address1" class="required" />

                          </li>

                         

                          <li>

                            <label for="address2"> Address 2:</label>

                            <input type="text" name="company" id="company" />

                          </li>

       

       

                          <li>

                            <label for="city"><em class="required">*</em> City:</label>

                            <input type="text" name="city" id="city" class="required" />

                          </li>

                         

                          <li>

                            <label for="state"> State:</label>

                                      <p class="state">Nevada</p>

                          </li>

       

       

       

       

                          <li>

                            <label for="property[]"><em class="required">*</em> Use of Property:</label>

                            <select name="property[]" multiple id="property[]" class="required">

                                      <option value="select" selected>Please Select...

                              <option value="assembly">Assembly/Meeting Place

                              <option value="commer">Commercial General

                              <option value="health">Health Care

                              <option value="indust">Industrial

                              <option value="land">Land

                              <option value="lodgeHosp">Lodging & Hospitality

                              <option value="mixed">Mixed-Use

                              <option value="multiFam">Multi-Family

                              <option value="office">Office

                              <option value="retail">Retail

                              <option value="senior">Senior Housing

                              <option value="shopping">Shopping Center

                              <option value="special">Special Purpose

                              <option value="sportEnt">Sports & Entertainment

                             </select>

                          </li>

                         

                          <li>

                            <label for="report[]"><em class="required">*</em> Report Type:</label>

                                      <select name="report[]" multiple id="report[]" class="required">

                                        <option value="select" selected>Please Select...

                                  <option value="self">Self Contained

                                  <option value="summary">Summary

                                  <option value="restricted">Restricted

                                  <option value="advise">Unknown (please advise)

                              </select>

                          </li>

                         

       

       

                          <li>

                            <label for="client_company"> Client Company:</label>

                            <input type="text" name="client_company" id="client_company" class="required" />

                          </li>

                 

                          <li>

                            <label for="client_first"><em class="required">*</em> Client First Name:</label>

                            <input type="text" name="client_first" id="client_first" class="required" />

                          </li>

        

                          <li>

                            <label for="client_last"><em class="required">*</em> Client last Name:</label>

                            <input type="text" name="client_last" id="client_last" class="required" />

                          </li>

       

       

                          <li>

                            <label for="client_phone"><em class="required">*</em> Client Phone:</label>

                            <input type="text" name="client_phone" id="client_phone" class="required" />

                          </li>

       

       

                          <li>

                            <label for="client_email"><em class="required">*</em> Client Email:</label>

                            <input type="text" name="client_email" id="client_email" class="required" />

                          </li>

       

       

        

                          <li>

                            <label for="message"> Message:</label>

                            <textarea name="message" id="message" ></textarea>

                          </li>

       

       

                          <li class="buttons submit">

                            <button type="submit">Submit</button>

                             </li>

       

       

                          <li class="buttons reset">

                            <button type="reset">Reset Form</button>

                             </li>

       

       

                              

                      </ol>

                    </form>

                    </div>

       

                          <!-- InstanceEndEditable --></div>

                 

       

                          <div id="footer">

                            <p class="footer-text">Copyright 2012    |    All rights reserved   |    382Designs</p>

          </div>

             

        </div>

        

      </div>

       

       

      </body>

      <!-- InstanceEnd --></html>

       

       

       

      Thank you so much for your help!! I have been killing myself trying to figure this out on my own. I really appreciate all the help I can get!

        • 1. Re: PHP Form mailer script problem.. Please help!
          Jon Fritz II MVP

          The error means your form script is not compatible with the PHP version your server is running. PHP 5 no longer uses the ereg function so anything attached to it will not function correctly without rewriting the code of the script.

           

          If there is a way to go back to PHP 4.x on that server, it would likely function correctly. If not, you will either need to re-write all of the ereg functions (ther are plenty of references on Google for "ereg function deprecated") or get a PHP 5.x compatible form script.

           

          I suggest www.tectite.com, they have a very nice PHP5 compatible form mail script if you don't plan to write the php yourself.

          • 2. Re: PHP Form mailer script problem.. Please help!
            Tahoe Systems Community Member

            Thank you so much!!! I will look into your link as soon as I get back to my computer. I can't tell you how much I appreciate the help. I have been pulling my hair out trying to get this function correctly.. Thank you!

            • 3. Re: PHP Form mailer script problem.. Please help!
              Tahoe Systems Community Member

              Hey again! So I am soo close! I have everything setup as far as I know it is setup correctly except it still isn't working. The error I am reciebing is "No valid recipients specified"... Notice that all the form fields have sent to me correctly so I know I am close!!!! Please please help. Thank you again!!I have setup the error part correctly because it is sending me an email telling there is an error here is the email:

               

               

              The following error occurred in FormMail :

              no_valid_recipients

              **********

              Error=The form has an internal error - no valid recipients were specified.

               

               

              email:

              realname:

               

              redirect: 'thankyou.html'

              name: 'a'

              company: 'a'

              address1: 'a'

              city: 'a'

              property: 'assembly'

              report: 'select'

              client_company: 'a'

              client_first: 'a'

              client_last: 'a'

              client_phone: 'a'

              client_email: 'a'

              message: 'a'

              Referring page was http://www.jeurmston.com/request_quote.html

              SERVER_NAME was www.jeurmston.com

              REQUEST_URI was /formmail.php

               

              User IP address was 71.94.18.70

              User agent was Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1

               

               

               

               

              I noticed in the directions that it said to setup a hidden field called recipients with the email it is supposed to go to here is what I have... can you please tell me where I am going wrong? Thank you so much!!!

               

              <form class="required-form" action="formmail.php" method="post">

                             <input type="hidden" name="redirect" value="thankyou.html" />    

                             <input type="hidden" name="recipients" value="jim@jeurmston.com" />         

                              <ol class="forms">

                                 

                                  <li>

                                    <label for="name"> Name of Property:</label>

                                    <input type="text" name="name" id="name" />

                                  </li>

                                 

                                  <li>

                                    <label for="company"> Name of Company/Owner:</label>

                                    <input type="text" name="company" id="company" />

                                  </li>

                                

                                  <li>

                                    <label for="address1"><em class="required">*</em> Address / APN #:</label>

                                    <input type="text" name="address1" id="address1" class="required" />

                                  </li>

                                 

                                  <li>

                                    <label for="address2"> Address 2:</label>

                                    <input type="text" name="company" id="company" />

                                  </li>

               

               

                                  <li>

                                    <label for="city"><em class="required">*</em> City:</label>

                                    <input type="text" name="city" id="city" class="required" />

                                  </li>

                                 

                                  <li>

                                    <label for="state"> State:</label>

                                              <p class="state">Nevada</p>

                                  </li>

               

               

               

               

                                  <li>

                                    <label for="property[]"><em class="required">*</em> Use of Property:</label>

                                    <select name="property[]" multiple id="property[]" class="required">

                                              <option value="select" selected>Please Select...

                                      <option value="assembly">Assembly/Meeting Place

                                      <option value="commer">Commercial General

                                      <option value="health">Health Care

                                      <option value="indust">Industrial

                                      <option value="land">Land

                                      <option value="lodgeHosp">Lodging & Hospitality

                                      <option value="mixed">Mixed-Use

                                      <option value="multiFam">Multi-Family

                                      <option value="office">Office

                                      <option value="retail">Retail

                                      <option value="senior">Senior Housing

                                      <option value="shopping">Shopping Center

                                      <option value="special">Special Purpose

                                      <option value="sportEnt">Sports & Entertainment

                                     </select>

                                  </li>

                                 

                                  <li>

                                    <label for="report[]"><em class="required">*</em> Report Type:</label>

                                              <select name="report[]" multiple id="report[]" class="required">

                                                <option value="select" selected>Please Select...

                                          <option value="self">Self Contained

                                          <option value="summary">Summary

                                          <option value="restricted">Restricted

                                          <option value="advise">Unknown (please advise)

                                      </select>

                                  </li>

                                 

               

               

                                  <li>

                                    <label for="client_company"> Client Company:</label>

                                    <input type="text" name="client_company" id="client_company" class="required" />

                                  </li>

                         

                                  <li>

                                    <label for="client_first"><em class="required">*</em> Client First Name:</label>

                                    <input type="text" name="client_first" id="client_first" class="required" />

                                  </li>

                

                                  <li>

                                    <label for="client_last"><em class="required">*</em> Client last Name:</label>

                                    <input type="text" name="client_last" id="client_last" class="required" />

                                  </li>

               

               

                                  <li>

                                    <label for="client_phone"><em class="required">*</em> Client Phone:</label>

                                    <input type="text" name="client_phone" id="client_phone" class="required" />

                                  </li>

               

               

                                  <li>

                                    <label for="client_email"><em class="required">*</em> Client Email:</label>

                                    <input type="text" name="client_email" id="client_email" class="required" />

                                  </li>

               

               

                

                                  <li>

                                    <label for="message"> Message:</label>

                                    <textarea name="message" id="message" ></textarea>

                                  </li>

               

               

                                  <li class="buttons submit">

                                    <button type="submit">Submit</button>

                                     </li>

               

               

                                  <li class="buttons reset">

                                    <button type="reset">Reset Form</button>

                                     </li>

               

               

                                      

                              </ol>

                            </form>

                            </div>

              • 4. Re: PHP Form mailer script problem.. Please help!
                Tahoe Systems Community Member

                Also, one more thing. I am having trouble finding a way to make the form redirect the user to my thankyou.html page after pressing submit. Obviously my methid isn't working, or the error may be preventing it? Any advice on this would be greatly appreciated as well! Thank you so much!

                • 5. Re: PHP Form mailer script problem.. Please help!
                  Jon Fritz II MVP

                  If you are using the Tectite.com form mail, you can troubleshoot the no_valid_recipient here:

                   

                  http://www.tectite.com/vbforums/faq.php?faq=formmail_faq#faq_formmail_email

                   

                  Usually it's going to require another hidden field like this...

                   

                  <input type="hidden" name="mail_options" value="FromAddr=someotheraddress@yourdomain.com" />

                   

                  There is likely a server setting stopping you from sending mail to yourself as if it's from another domain.

                   

                  The redirect hidden field is called "good_url" (there is also a bad_url for if/when the form is not processed). You can find all of the hidden fields here: http://www.tectite.com/fmdoc/creating_forms.php

                  • 6. Re: PHP Form mailer script problem.. Please help!
                    Tahoe Systems Community Member

                    Thank you! Yes I am using the formmail.php that you reccommended and this is the exact information I was looking for! I really appreciate it. I will update after I troubleshoot.

                     

                    Thanks again!!!!

                     

                    -Greg

                    • 7. Re: PHP Form mailer script problem.. Please help!
                      Tahoe Systems Community Member

                      I have updtated the changes that you have shown me above. One more time here is my complete form, as it looks now, if you don't mind taking a look?:

                       

                       

                      <form class="required-form" action="formmail.php" method="post">

                                     <input type="hidden" name="redirect" value="thankyou.html" />    

                                     <input type="hidden" name="mail_options" value="FromAddr=jim@jeurmston.com" />         

                                      <ol class="forms">

                                         

                                          <li>

                                            <label for="name"> Name of Property:</label>

                                            <input type="text" name="name" id="name" />

                                          </li>

                                         

                                          <li>

                                            <label for="company"> Name of Company/Owner:</label>

                                            <input type="text" name="company" id="company" />

                                          </li>

                                        

                                          <li>

                                            <label for="address1"><em class="required">*</em> Address / APN #:</label>

                                            <input type="text" name="address1" id="address1" class="required" />

                                          </li>

                                         

                                          <li>

                                            <label for="address2"> Address 2:</label>

                                            <input type="text" name="company" id="company" />

                                          </li>

                       

                       

                                          <li>

                                            <label for="city"><em class="required">*</em> City:</label>

                                            <input type="text" name="city" id="city" class="required" />

                                          </li>

                                         

                                          <li>

                                            <label for="state"> State:</label>

                                                      <p class="state">Nevada</p>

                                          </li>

                       

                       

                       

                       

                                          <li>

                                            <label for="property[]"><em class="required">*</em> Use of Property:</label>

                                            <select name="property[]" multiple id="property[]" class="required">

                                                      <option value="select" selected>Please Select...

                                              <option value="assembly">Assembly/Meeting Place

                                              <option value="commer">Commercial General

                                              <option value="health">Health Care

                                              <option value="indust">Industrial

                                              <option value="land">Land

                                              <option value="lodgeHosp">Lodging & Hospitality

                                              <option value="mixed">Mixed-Use

                                              <option value="multiFam">Multi-Family

                                              <option value="office">Office

                                              <option value="retail">Retail

                                              <option value="senior">Senior Housing

                                              <option value="shopping">Shopping Center

                                              <option value="special">Special Purpose

                                              <option value="sportEnt">Sports & Entertainment

                                             </select>

                                          </li>

                                         

                                          <li>

                                            <label for="report[]"><em class="required">*</em> Report Type:</label>

                                                      <select name="report[]" multiple id="report[]" class="required">

                                                        <option value="select" selected>Please Select...

                                                  <option value="self">Self Contained

                                                  <option value="summary">Summary

                                                  <option value="restricted">Restricted

                                                  <option value="advise">Unknown (please advise)

                                              </select>

                                          </li>

                                         

                       

                       

                                          <li>

                                            <label for="client_company"> Client Company:</label>

                                            <input type="text" name="client_company" id="client_company" class="required" />

                                          </li>

                                 

                                          <li>

                                            <label for="client_first"><em class="required">*</em> Client First Name:</label>

                                            <input type="text" name="client_first" id="client_first" class="required" />

                                          </li>

                        

                                          <li>

                                            <label for="client_last"><em class="required">*</em> Client last Name:</label>

                                            <input type="text" name="client_last" id="client_last" class="required" />

                                          </li>

                       

                       

                                          <li>

                                            <label for="client_phone"><em class="required">*</em> Client Phone:</label>

                                            <input type="text" name="client_phone" id="client_phone" class="required" />

                                          </li>

                       

                       

                                          <li>

                                            <label for="client_email"><em class="required">*</em> Client Email:</label>

                                            <input type="text" name="client_email" id="client_email" class="required" />

                                          </li>

                       

                       

                        

                                          <li>

                                            <label for="message"> Message:</label>

                                            <textarea name="message" id="message" ></textarea>

                                          </li>

                       

                       

                                          <li class="buttons submit">

                                            <button type="submit">Submit</button>

                                             </li>

                       

                       

                                          <li class="buttons reset">

                                            <button type="reset">Reset Form</button>

                                             </li>

                       

                       

                                              

                                      </ol>

                                    </form>

                       

                       

                      I am now recieving a new, but similar error, here is the email that I am recieving:

                       

                       

                      The following error occurred in FormMail :

                      no_recipients

                      **********

                      Error=The form has an internal error - no actions or recipients were specified.

                       

                       

                      email:

                      realname:

                       

                      redirect: 'thankyou.html'

                      name: 'c'

                      company: 'c'

                      address1: 'c'

                      city: 'c'

                      property: 'commer'

                      report: 'select'

                      client_company: 'c'

                      client_first: 'c'

                      client_last: 'c'

                      client_phone: 'c'

                      client_email: 'c'

                      message: 'c'

                      Referring page was http://www.jeurmston.com/request_quote.html

                      SERVER_NAME was www.jeurmston.com

                      REQUEST_URI was /formmail.php

                       

                      User IP address was 71.94.18.70

                      User agent was Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1

                       

                       

                       

                       

                      I am sorry for all the questions, I just really have no idea how to fix it. I have reviewed the link that you showed me and I have followed the instructions as far as I know correctly, still with no results. I really really appreciate you taking the time to take a look though. So thank you. Very much..

                       

                      -Greg

                      • 8. Re: PHP Form mailer script problem.. Please help!
                        Jon Fritz II MVP

                        The hidden field with the name "redirect" should be named "good_url"

                         

                        You need both the "recipients" hidden field and the "mail_options...FromAddr" hidden fields.

                        • 9. Re: PHP Form mailer script problem.. Please help!
                          Tahoe Systems Community Member

                          YOU ARE MY HERO!!!!! Thank you soooooo much!!!! I can't tell you how much I appreciate your help!~! I have been working on this non-stop for 3 days now!!! THank you!!!!

                           

                          IT WORKS! hahaha

                           

                          One last question, and if you don't know or can't answer it's fine but I noticed that there was no subject line to the email when I recieve it, do you know how to fix that by chance? If not it's ok, you are the best anyway! Hahah, Thank you soooo much for tkaing your time to help me...

                           

                          -Thank you again!!!

                           

                          -Greg

                          • 10. Re: PHP Form mailer script problem.. Please help!
                            Jon Fritz II MVP

                            Sure, that's in the documentation too, you add a hidden field called "subject" with the value set as whatever you want the subject to be.

                            • 11. Re: PHP Form mailer script problem.. Please help!
                              Tahoe Systems Community Member

                              Thank you so much for taking your time to help me... Very kind of you.

                               

                              -Greg