Menu

Formatting in e-mail using phpForm

Help
2006-03-01
2013-06-03
  • head_injury-2

    head_injury-2 - 2006-03-01

    This is a case of the e-mail displaying formating code, but not formating the e-mail contents (all in one line).

    eg:
    Date: Feb 23rd 10amName: Darrin (c/- Hanlon Marketing & Design)Address: Quinpool Road  Hfx.Phone: 902.422.6453E Mail: Ad: TV: Web Site: onFriend: MLS: Other: Sell Yes: Sell No: on1 Bdrm plus Den: 2 Bdrm plus Den: 3 Bdrm: Penthouse:
    Townhouse: Phone back: Email back: onSuggestions: Good Morning Glenys,&nbsp;<br />&nbsp;<br />&nbsp;<br />Just testing the form on your Web Site.&nbsp;<br />&nbsp;<br />The result, should be an e-mail indicating which questions have been&nbsp;<br />answered with the term:  "on" after the answer, or the text typed by the contact in the space
    provided.&nbsp;<br />&nbsp;<br />If this works, please contact me by e-mail <br />&nbsp;<br />kind regards,&nbsp;<br
    />&nbsp;<br />Darrin

    I have found this issue explained in the help forum several times, but I cannot locate the code that has to be altered.

    Here is the process.php I have generated:

    <?php
    include("global.inc.php");
    $errors=0;
    $error="The following errors occured while processing your form input.<ul>";
    pt_register('POST','Date');
    pt_register('POST','Name');
    pt_register('POST','Address');
    pt_register('POST','Phone');
    pt_register('POST','EMail');
    pt_register('POST','Ad');
    pt_register('POST','TV');
    pt_register('POST','WebSite');
    pt_register('POST','Friend');
    pt_register('POST','MLS');
    pt_register('POST','Other');
    $Other=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $Other);pt_register('POST','SellYes');
    pt_register('POST','SellNo');
    pt_register('POST','1BdrmplusDen');
    pt_register('POST','2BdrmplusDen');
    pt_register('POST','3Bdrm');
    pt_register('POST','Penthouse');
    pt_register('POST','Townhouse');
    pt_register('POST','Phoneback');
    pt_register('POST','Emailback');
    pt_register('POST','Suggestions');
    $Suggestions=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $Suggestions);if($Name=="" || $Address=="" || $Phone=="" ){
    $errors=1;
    $error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
    }
    if($errors==1) echo $error;
    else{
    $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
    $message="Date: ".$Date."
    Name: ".$Name."
    Address: ".$Address."
    Phone: ".$Phone."
    E Mail: ".$EMail."
    Ad: ".$Ad."
    TV: ".$TV."
    Web Site: ".$WebSite."
    Friend: ".$Friend."
    MLS: ".$MLS."
    Other: ".$Other."
    Sell Yes: ".$SellYes."
    Sell No: ".$SellNo."
    1 Bdrm plus Den: ".$oneBdrmplusDen."
    2 Bdrm plus Den: ".$twoBdrmplusDen."
    3 Bdrm: ".$threeBdrm."
    Penthouse: ".$Penthouse."
    Townhouse: ".$Townhouse."
    Phone back: ".$Phoneback."
    Email back: ".$Emailback."
    Suggestions: ".$Suggestions."
    ";
    $message = stripslashes($message);
    mail("glenys@royallepages.ca","Glenys Preferred Client Registration",$message,"From: Armoury Square website");
    ?>

    <!-- This is the content of the Thank you page, be careful while changing it -->
    <h5>Thank you. The following information has been
    sent to<br>
    Glenys, as provided in your Preferred Client Registration.</h5>

    <table width=50%>
    <tr><td>Date: </td><td> <?php echo $Date; ?> </td></tr>
    <tr><td>Name: </td><td> <?php echo $Name; ?> </td></tr>
    <tr><td>Address: </td><td> <?php echo $Address; ?> </td></tr>
    <tr><td>Phone: </td><td> <?php echo $Phone; ?> </td></tr>
    <tr><td>E Mail: </td><td> <?php echo $EMail; ?> </td></tr>
    <tr><td>Ad: </td><td> <?php echo $Ad; ?> </td></tr>
    <tr><td>TV: </td><td> <?php echo $TV; ?> </td></tr>
    <tr><td>Web Site: </td><td> <?php echo $WebSite; ?> </td></tr>
    <tr><td>Friend: </td><td> <?php echo $Friend; ?> </td></tr>
    <tr><td>MLS: </td><td> <?php echo $MLS; ?> </td></tr>
    <tr><td>Other: </td><td> <?php echo $Other; ?> </td></tr>
    <tr><td>Sell Yes: </td><td> <?php echo $SellYes; ?> </td></tr>
    <tr><td>Sell No: </td><td> <?php echo $SellNo; ?> </td></tr>
    <tr><td>1 Bdrm plus Den: </td><td> <?php echo $oneBdrmplusDen; ?> </td></tr>
    <tr><td>2 Bdrm plus Den: </td><td> <?php echo $twoBdrmplusDen; ?> </td></tr>
    <tr><td>3 Bdrm: </td><td> <?php echo $threeBdrm; ?> </td></tr>
    <tr><td>Penthouse: </td><td> <?php echo $Penthouse; ?> </td></tr>
    <tr><td>Townhouse: </td><td> <?php echo $Townhouse; ?> </td></tr>
    <tr><td>Phone back: </td><td> <?php echo $Phoneback; ?> </td></tr>
    <tr><td>Email back: </td><td> <?php echo $Emailback; ?> </td></tr>
    <tr><td>Suggestions: </td><td> <?php echo $Suggestions; ?> </td></tr>
    </table>
    <br>
    Return to <a href="http://www.armourysquare.com">Armoury Square</a>

    <!-- Do not change anything below this line -->

    <?php
    }
    ?>

     
    • TNTEverett

      TNTEverett - 2006-03-12

      The change requires that you add extra header information to the email message.  You should have found this in another post but I'll repeat it here for your benefit. 

      #####################################
      send as html by adding the following: 
      on the line prior to 
      $message = stripslashes($message); 

      add this code 

      $header = "From: phpFormGenerator\r\n" . 
      "Content-Type: text/html; charset=iso-8859-1\r\n" ; 

      then change this line 

      mail("youremail","Form Submitted at your website",$message,"From: 
      phpFormGenerator"); 

      to this line 

      mail("youremail","Form Submitted at your website",$message,$header);
      #####################################
      The post containing this solution can be found here:
      https://sourceforge.net/forum/forum.php?thread_id=1428250&forum_id=149299

       
    • head_injury-2

      head_injury-2 - 2006-03-12

      brpwser displays this error:

      Parse error: parse error, unexpected T_STRING in /usr/local/psa/home/vhosts/ArmourySquare.com/httpdocs/process.php on line 54

       
      • TNTEverett

        TNTEverett - 2006-03-12

        It's likely you have a variable name that starts with a number.
        $1Name
        instead of
        $oneName or $Name1

        Numbers in the first character position are not valid. 

         
        • head_injury-2

          head_injury-2 - 2006-03-12

          No I am not using any numbers and the same browser error occurs.

          Just so you know, I am using 2 forms on the site, almost identical (only changes being the e-mail address) with no problems at all with the other forms reply/formating.

          Hmmm ... tricky.

           
          • TNTEverett

            TNTEverett - 2006-03-13

            Whats on line 54 of your process.php file?

             

Log in to post a comment.