15 Replies Latest reply on Jan 7, 2016 4:04 PM by jennifermeyer54

    I'm having trouble getting the PHP script to send form data to an email.


      I have a very basic contact form that I've used before, and I've pointed it to a standard SendResults.php file. I've uploaded both to the server for testing, but I'm not receiving the emails from the form. Can anybody help me with this?


      Here is the code for the form:



                <p><img src="images/contact-hands.jpg" alt="hands" width="401" height="299" class="photo-on-left" align="left" /></p>

                <p class="fax"> </p>

                <p class="fax"> </p>

                <p class="fax">Please call or use the form below to send your contact information and I will respond to you as quickly as possible.</p>

                <p class="phone-number">541 954 2602          </p>

                <p class="center">Ronit Cohen          </p>

                <p> </p>

                <p> </p>

                <h3 class="center">Use the form below to send a message and I will contact you promptly.</h3>

                <table width="600" border="1" align="center" cellpadding="22" cellspacing="0">


                    <td bgcolor="#F0F0F0"><form action="sendresults.php" method="post" name="Contact form" id="Contact form">

                      <p>Name<span class="red">*</span>

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


                      <p>Email Address<span class="red">*</span>

                        <input name="email" type="text" id="email" size="65" />


                      <p>Phone Number

                        <input name="phone" type="text" id="phone" size="40" />



                        <label>Message<br />

      <textarea name="message" id="message" cols="70

      " rows="5"></textarea>



                      <p class="center">

                        <input name="submit" type="submit" id="submit" onclick="MM_openBrWindow('thankyou.html','','width=500,height=400');MM_validateForm('name ','','R','email','','RisEmail','phone','','NisNum');return document.MM_returnValue" value="Send Message" />


                        <input type="reset" name="cancel" id="cancel" value="Cancel" />





                <p> </p>

                <p> </p>

                <p> </p>

              <!-- InstanceEndEditable --></td>




      And here is the code for the sendresults.php file:

      //--------------------------Set these paramaters--------------------------

      // Subject of email sent to you.
      $subject = 'Info sent from "A Home to Fit You" Contact form';

      // Your email address. This is where the form information will be sent.
      $emailadd = 'jennifermeyer54@yahoo.com';

      // Where to redirect after form is processed.
      $url = 'http://www.tributewebdesign.com/home-to-fit/contact.html';

      // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
      $req = '0';

      // --------------------------Do not edit below this line--------------------------
      $text = "Results from form:\n\n";
      $space = ' ';
      $line = '
      foreach ($_POST as $key => $value)
      if ($req == '1')
      if ($value == '')
      {echo "$key is empty";die;}
      $j = strlen($key);
      if ($j >= 20)
      {echo "Name of form element $key cannot be longer than 20 characters";die;}
      $j = 20 - $j;
      for ($i = 1; $i <= $j; $i++)
      {$space .= ' ';}
      $value = str_replace('\n', "$line", $value);
      $conc = "{$key}:$space{$value}$line";
      $text .= $conc;
      $space = ' ';
      mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
      echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';


      I'd appreciate any help anyone has to offer.