2 Replies Latest reply: Nov 28, 2010 12:25 PM by Swondk RSS

    PHP Send an Email Scriping

    C-akin

      Ive sat down and looked over my scripting and all seems to look good, i'm just not sure why its not working. I'd really appreciate if someone could help me out and take a look at my codes. Its pretty basic stuff and i dont know why its not working. It sends an email but only sends:

       

      Email:
      Name:
      Phone Number:
      Comments:

       

       

      Any how here is my code, thanks in advance for any help:

       

      <?php

      /*  Subject and Email Variables */


            $emailSubject = 'Question/Comments from Anoba Consulting Website';
            $webMaster = 'ranoba@anoba-pra.com';

      /* Gathering data variables */

            $emailField = $_POST ['email'];
            $nameField = $_POST ['name'];
            $phoneField = $_POST ['phone'];
            $commentsField = $_POST ['comments'];

      $body = <<<EOD
      <br><hr><br>
      Email: $email <br>
      Name: $name <br>
      Phone Number: $phone <br>
      Comments: $comments <br>
      EOD;

            $headers = "From: $email\r\n";
            $headers .= "Content-type: text/html\r\n";
            $success = mail($webMaster, $emailSubject, $body, $headers);


      /* Results rendered as HTML */

            $theResults = <<<EOD
      <html>
      <head>
      <title>Anoba Consulting Servies</title>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      <style type="text/css">
      <!--
      body {
      background-color: #f1f1f1;
            font-family: Verdana, Arial, Helvetica, sans-serif;
            font-size: 12px;
            font-style: normal;
            line-height: normal;
            font-weight: normal;
            color: #666666;
            text-decoration: none;
      }
      -->
      </style>
      </head>

      <div>
        <div align="left">Thank you question or comment Your questions will be answered soon!</div>
      </div>
      </body>
      </html>
      EOD;
      echo "$theResults";

      ?>

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html>
      <head>
      <!-- TemplateBeginEditable name="doctitle" -->
      <title>anobaconsulting.com</title>
      <!-- TemplateEndEditable -->
        <link rel="stylesheet" type="text/css" href="CSS/stylesheet.css" />
       
       
        <!-- TemplateBeginEditable name="head" -->
        <!-- TemplateEndEditable -->
      <style type="text/css">
      <!--
      div {
      text-align: left;
      }
      .selector1 {
      text-align: center;
      }
      .selector1 {
      text-align: center;
      }
      body {
      background-color: #000;
      }
      -->
              </style>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /></head>
      <body>
        <div class="container">
         <div class="bannerArea">  
          <div class="bannernav"></div>
         </div>
         <div class="contentArea">
          <ul class="leftnavigation">
           <li><a href="index.html">Home</a></li>
           <li><a href="indexABOUT.html">About</a></li>
           <li><a href="indexSERVICES.html">Services</a><a href="#" >Contact</a></li>
           <li></li>
          </ul>
          <div class="content"><!-- TemplateBeginEditable name="content" -->
           <div class="contentleft">
             <h1>Contact</h1>
             <p>Please feel free to contact Anoba Consulting with any questions or comments.</p>
                            <div align="right">
                              <form id="form1" name="form1" method="post" action="PHP/contactform.php">
                                <table width="100%" border="1" align="center" cellpadding="6">
                                  <tr>
                                    <td><label for="emal">Email:</label></td>
                                    <td><input name="emal" type="text" id="emal" size="35" maxlength="90" /></td>
                                  </tr>
                                  <tr>
                                    <td><label for="name">Name:</label></td>
                                    <td><input name="name" type="text" id="name" size="35" maxlength="90" /></td>
                                  </tr>
                                  <tr>
                                    <td><label for="phone">Phone:</label></td>
                                    <td><input name="phone" type="text" id="phone" size="35" maxlength="12" /></td>
                                  </tr>
                                  <tr>
                                    <td height="103"><label for="comments">Questions/Comments:</label></td>
                                    <td><textarea name="comments" id="comments" cols="27" rows="5"></textarea></td>
                                  </tr>
                                  <tr>
                                    <td height="69" class="selector1"><label for="reset"></label>
                                    <input type="reset" name="reset" id="reset" value="Reset Form" /></td>
                                    <td class="selector1"><label for="submit"></label>
                                    <input type="submit" name="submit" id="submit" value="Send Email" /></td>
                                  </tr>
                                </table>
                              </form>
                              <p><img src="images/800px-Nuclear_Power_Plant_Cattenom_a.png" width="438" height="168" /></p>
                              <ul>
                                <li>Address: 4441 Six Forks Road, Suite   106-226 Raleigh, NC 27609</li>
                                <li>Phone: (650) 678-6784</li>
                                <li>FAX: (413) 473-3114 </li>
                                <li>E-mails: <a href="mailto:ranoba@anoba-pra.com">ranoba@anoba-pra.com</a> </li>
                              </ul>
                            </div>
      </div>
          <!-- TemplateEndEditable -->
            <div style="clear:both;"></div>
           </div>
          <div style="clear:both;"></div>
           </div>
         <div class="footerArea">
          <div class="copyright">&copy; Anoba Consulting Services LLC.  All rights reserved.</div>
         </div> 
        </div>
      </body>
      </html>

      And the actualy page its Linking to Is:

       

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html>
      <head>
      <!-- TemplateBeginEditable name="doctitle" -->
      <title>anobaconsulting.com</title>
      <!-- TemplateEndEditable -->
        <link rel="stylesheet" type="text/css" href="CSS/stylesheet.css" />
       
       
        <!-- TemplateBeginEditable name="head" -->
        <!-- TemplateEndEditable -->
      <style type="text/css">
      <!--
      div {
      text-align: left;
      }
      .selector1 {
      text-align: center;
      }
      .selector1 {
      text-align: center;
      }
      body {
      background-color: #000;
      }
      -->
              </style>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /></head>
      <body>
        <div class="container">
         <div class="bannerArea">  
          <div class="bannernav"></div>
         </div>
         <div class="contentArea">
          <ul class="leftnavigation">
           <li><a href="index.html">Home</a></li>
           <li><a href="indexABOUT.html">About</a></li>
           <li><a href="indexSERVICES.html">Services</a><a href="#" >Contact</a></li>
           <li></li>
          </ul>
          <div class="content"><!-- TemplateBeginEditable name="content" -->
           <div class="contentleft">
             <h1>Contact</h1>
             <p>Please feel free to contact Anoba Consulting with any questions or comments.</p>
                            <div align="right">
                              <form id="form1" name="form1" method="post" action="PHP/contactform.php">
                                <table width="100%" border="1" align="center" cellpadding="6">
                                  <tr>
                                    <td><label for="emal">Email:</label></td>
                                    <td><input name="emal" type="text" id="emal" size="35" maxlength="90" /></td>
                                  </tr>
                                  <tr>
                                    <td><label for="name">Name:</label></td>
                                    <td><input name="name" type="text" id="name" size="35" maxlength="90" /></td>
                                  </tr>
                                  <tr>
                                    <td><label for="phone">Phone:</label></td>
                                    <td><input name="phone" type="text" id="phone" size="35" maxlength="12" /></td>
                                  </tr>
                                  <tr>
                                    <td height="103"><label for="comments">Questions/Comments:</label></td>
                                    <td><textarea name="comments" id="comments" cols="27" rows="5"></textarea></td>
                                  </tr>
                                  <tr>
                                    <td height="69" class="selector1"><label for="reset"></label>
                                    <input type="reset" name="reset" id="reset" value="Reset Form" /></td>
                                    <td class="selector1"><label for="submit"></label>
                                    <input type="submit" name="submit" id="submit" value="Send Email" /></td>
                                  </tr>
                                </table>
                              </form>
                              <p><img src="images/800px-Nuclear_Power_Plant_Cattenom_a.png" width="438" height="168" /></p>
                              <ul>
                                <li>Address: 4441 Six Forks Road, Suite   106-226 Raleigh, NC 27609</li>
                                <li>Phone: (650) 678-6784</li>
                                <li>FAX: (413) 473-3114 </li>
                                <li>E-mails: <a href="mailto:ranoba@anoba-pra.com">ranoba@anoba-pra.com</a> </li>
                              </ul>
                            </div>
      </div>
          <!-- TemplateEndEditable -->
            <div style="clear:both;"></div>
           </div>
          <div style="clear:both;"></div>
           </div>
         <div class="footerArea">
          <div class="copyright">&copy; Anoba Consulting Services LLC.  All rights reserved.</div>
         </div> 
        </div>
      </body>
      </html>

      And the actualy page its Linking to Is:

      And the actualy page its Linking to Is:

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html>
      <head>
      <!-- TemplateBeginEditable name="doctitle" -->
      <title>anobaconsulting.com</title>
      <!-- TemplateEndEditable -->
        <link rel="stylesheet" type="text/css" href="CSS/stylesheet.css" />
       
       
        <!-- TemplateBeginEditable name="head" -->
        <!-- TemplateEndEditable -->
      <style type="text/css">
      <!--
      div {
      text-align: left;
      }
      .selector1 {
      text-align: center;
      }
      .selector1 {
      text-align: center;
      }
      body {
      background-color: #000;
      }
      -->
              </style>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /></head>
      <body>
        <div class="container">
         <div class="bannerArea">  
          <div class="bannernav"></div>
         </div>
         <div class="contentArea">
          <ul class="leftnavigation">
           <li><a href="index.html">Home</a></li>
           <li><a href="indexABOUT.html">About</a></li>
           <li><a href="indexSERVICES.html">Services</a><a href="#" >Contact</a></li>
           <li></li>
          </ul>
          <div class="content"><!-- TemplateBeginEditable name="content" -->
           <div class="contentleft">
             <h1>Contact</h1>
             <p>Please feel free to contact Anoba Consulting with any questions or comments.</p>
                            <div align="right">
                              <form id="form1" name="form1" method="post" action="PHP/contactform.php">
                                <table width="100%" border="1" align="center" cellpadding="6">
                                  <tr>
                                    <td><label for="emal">Email:</label></td>
                                    <td><input name="emal" type="text" id="emal" size="35" maxlength="90" /></td>
                                  </tr>
                                  <tr>
                                    <td><label for="name">Name:</label></td>
                                    <td><input name="name" type="text" id="name" size="35" maxlength="90" /></td>
                                  </tr>
                                  <tr>
                                    <td><label for="phone">Phone:</label></td>
                                    <td><input name="phone" type="text" id="phone" size="35" maxlength="12" /></td>
                                  </tr>
                                  <tr>
                                    <td height="103"><label for="comments">Questions/Comments:</label></td>
                                    <td><textarea name="comments" id="comments" cols="27" rows="5"></textarea></td>
                                  </tr>
                                  <tr>
                                    <td height="69" class="selector1"><label for="reset"></label>
                                    <input type="reset" name="reset" id="reset" value="Reset Form" /></td>
                                    <td class="selector1"><label for="submit"></label>
                                    <input type="submit" name="submit" id="submit" value="Send Email" /></td>
                                  </tr>
                                </table>
                              </form>
                              <p><img src="images/800px-Nuclear_Power_Plant_Cattenom_a.png" width="438" height="168" /></p>
                              <ul>
                                <li>Address: 4441 Six Forks Road, Suite   106-226 Raleigh, NC 27609</li>
                                <li>Phone: (650) 678-6784</li>
                                <li>FAX: (413) 473-3114 </li>
                                <li>E-mails: <a href="mailto:ranoba@anoba-pra.com">ranoba@anoba-pra.com</a> </li>
                              </ul>
                            </div>
      </div>
          <!-- TemplateEndEditable -->
            <div style="clear:both;"></div>
           </div>
          <div style="clear:both;"></div>
           </div>
         <div class="footerArea">
          <div class="copyright">&copy; Anoba Consulting Services LLC.  All rights reserved.</div>
         </div> 
        </div>
      </body>
      </html>

       

        • 1. Re: PHP Send an Email Scriping
          garywpaul Community Member

          C-akin wrote:

           


          /* Gathering data variables */

                $emailField = $_POST ['email'];
               $nameField = $_POST ['name'];
                $phoneField = $_POST ['phone'];
               $commentsField = $_POST ['comments'];

          $body = <<<EOD
          <br><hr><br>
          Email: $email <br>//this should be $emailField
          Name: $name <br>//this should be $nameField
          Phone Number: $phone <br>//this should be $phoneField
          Comments: $comments <br>//this should be $commentsField
          EOD;

                $headers = "From: $email\r\n";
                $headers .= "Content-type: text/html\r\n";
                $success = mail($webMaster, $emailSubject, $body, $headers)


          You are naming your variables wrong....

           

          Gary

          • 2. Re: PHP Send an Email Scriping
            Swondk Community Member

            Your form links to this file: <form id="form1" name="form1" method="post" action="PHP/contactform.php">

            do it exist? or have you moved the php.

             

            Best Regards

            Sven Philipsen

            hjemmeside