Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Inconsistant output in PHP mail script.

Explorer ,
Apr 26, 2017 Apr 26, 2017

I have a form and a script. when I put all nonsense like all a into the text fields (except the "sender email field") and put say any number at all the form works fine. AS soon as I try to put a real address into that field, the top of the form in the email fails to separate each line of input. Is there some reason as soon as I enter a street address or a real phone number into those areas, it makes the items above the line break all string together. I note, the bottom part of the form with the sizes works fine as long as you put in numbers, and even when the top does not.

Here is the form:

<form action="TEMPLATE_MAILSCRIPT_BUILD_1.php" method="post" name="ContactForm" id="ContactForm">

<table align="center" width="850" border="2" cellspacing="0" cellpadding="0">

    <tr>

          <th colspan="4"><span style="">Company Information - Retail Location</span></th>

    </tr>

    <tr>

        <th align="left" width="280"> Company Name :<br> <input type ="text" name ="CompanyName" size ="32"></th>

        <th align="left" colspan="3"> Company Address :<br> <input type ="text" name ="CompanyAddress" size ="72"></th>

    </tr>

    <tr>

        <th align="left" width="280"> Company Phone :<br> <input type ="text" name ="CompanyPhone" size ="20"></th>

        <th colspan="2" align="left"> Company Email :<br> <input type ="text" name ="CompanyEmail" size ="40"></th>

        <th colspan="2" align="left"> Company Website :<br> www.<input type ="text" name ="URL" size ="20"></th>

    </tr>

    <tr>

        <th colspan="4">Authorized Buyer Info</th>

    </tr>

    <tr>

        <th colspan="2" align="left"> Your Name :<br> <input type ="text" name ="ContactName" size ="48"></th>

        <th width="213" align="left"> Your Phone :<br> <input type ="text" name ="ContactPhone" size ="20"></th>

        <th width="234" align="left"> Your Email :<br> <input type ="text" name="Sender" id="Sender" size ="25" form="ContactForm"></th>

     </tr>

     <tr><th colspan="1" align="left"><label for="Subject"> Subject:<br></label> <input name="Subject" type="text" id="Subject"form="ContactForm"/></th>

         <th colspan="3"><label for="Message">Please leave any questions or special instructions below :</label><br><textarea name="Message" cols="50" rows="2" id="Message" form="ContactForm"></textarea></th>

     </tr>

</table>

<br>

<table align="center" width="850" border="2" cellspacing="0" cellpadding="0" id="Table1">

    <tr>

        <th colspan="2"> </th>

     </tr>

     <tr>

         <td width="165"> </td>

         <td width="675" align="center"> </td>

    </tr>

    <tr>

          <td> </td>

          <td> </td>

    </tr>

    <tr>

        <td>Red w/green logo</td>

   

    <td align="center">

      <label for="Field1">XXS</label>

      <input type="number" name="RedGreenXXS" id="Field1" form="ContactForm">

   

      <label for="Field1">XS</label>

      <input type="number" name="RedGreenXS" id="Field1" form="ContactForm">

     

      <label for="Field1">S</label>

      <input type="number" name="RedGreenS" id="Field1" form="ContactForm">

     

      <label for="Field1">M</label>

      <input type="number" name="RedGreenM" id="Field1" form="ContactForm">

     

      <label for="Field1">L</label>

      <input type="number" name="RedGreenL" id="Field1" form="ContactForm">

     

      <label for="Field1">XL</label>

      <input type="number" name="RedGreenXL" id="Field1" form="ContactForm">

     

      <label for="Field1">XXL</label>

      <input type="number" name="RedGreenXXL" id="Field1" form="ContactForm">

     

      <label for="Field1">XXXL</label>

      <input type="number" name="RedGreenXXXL" id="Field1" form="ContactForm">   

    </td>

   

  </tr>

 

  <tr>

    <td> </td>

    <td> </td>

  </tr>

 

    <tr>

    <td>Red w/blue logo</td>

   

    <td align="center">

      <label for="Field1">XXS</label>

      <input type="number" name="RedBlueXXS" id="Field1" form="ContactForm">

   

      <label for="Field1">XS</label>

      <input type="number" name="RedBlueXS" id="Field1" form="ContactForm">

     

      <label for="Field1">S</label>

      <input type="number" name="RedBlueS" id="Field1" form="ContactForm">

     

      <label for="Field1">M</label>

      <input type="number" name="RedBlueM" id="Field1" form="ContactForm">

     

      <label for="Field1">L</label>

      <input type="number" name="RedBlueL" id="Field1" form="ContactForm">

     

      <label for="Field1">XL</label>

      <input type="number" name="RedBlueXL" id="Field1" form="ContactForm">

     

      <label for="Field1">XXL</label>

      <input type="number" name="RedBlueXXL" id="Field1" form="ContactForm">

     

      <label for="Field1">XXXL</label>

      <input type="number" name="RedBlueXXXL" id="Field1" form="ContactForm">   

    </td>

   

  </tr>

 

  <tr>

    <td> </td>

    <td> </td>

  </tr>

 

  <tr>

    <td>Red w/white logo</td>

   

    <td align="center">

      <label for="Field1">XXS</label>

      <input type="number" name="RedWhiteXXS" id="Field1" form="ContactForm">

   

      <label for="Field1">XS</label>

      <input type="number" name="RedWhiteXS" id="Field1" form="ContactForm">

     

      <label for="Field1">S</label>

      <input type="number" name="RedWhiteS" id="Field1" form="ContactForm">

     

      <label for="Field1">M</label>

      <input type="number" name="RedWhiteM" id="Field1" form="ContactForm">

     

      <label for="Field1">L</label>

      <input type="number" name="RedWhiteL" id="Field1" form="ContactForm">

     

      <label for="Field1">XL</label>

      <input type="number" name="RedWhiteXL" id="Field1" form="ContactForm">

     

      <label for="Field1">XXL</label>

      <input type="number" name="RedWhiteXXL" id="Field1" form="ContactForm">

     

      <label for="Field1">XXXL</label>

      <input type="number" name="RedWhiteXXXL" id="Field1" form="ContactForm">   

    </td>

   

  </tr>

 

  <tr>

    <td> </td>

    <td> </td>

  </tr>

 

  <tr align="center">

    <td colspan="4">

     <input name="SubmitButton" type="submit" id="Submit Button" value="Submit Order" form="ContactForm"/>

    </td>

  </tr>

  <tr>

    <td> </td>

    <td> </td>

  </tr>

</table>

</form>

and here is the script:

<?php

$from="orderform@anymail.com";

$email="info@anyplace.com,['Sender']";

$subject=$_POST['Subject'];

$message=$_POST['']."

Company Name = ".$_POST['CompanyName']."

Company Address = ".$_POST['CompanyAddress']."

Company Phone = ".$_POST['CompanyPhone']."

Company Email = ".$_POST['CompanyEmail']."

Company Website = ".$_POST['URL']."

Contact Name = ".$_POST['ContactName']."

Contact Phone = ".$_POST['ContactPhone']."

Sender = ".$_POST['Sender']."

".$_POST['<hr>']."

Message from Sender = ".$_POST['Message']."

".$_POST['<hr>']." 

RedWithGreenXXS = ".$_POST['RedGreenXXS']."

RedWithGreenXS = ".$_POST['RedGreenXS']."

RedWithGreenS = ".$_POST['RedGreenS']."

RedWithGreenM = ".$_POST['RedGreenM']."

RedWithGreenL = ".$_POST['RedGreenL']."

RedWithGreenXL = ".$_POST['RedGreenXL']."

RedWithGreenXXL = ".$_POST['RedGreenXXL']."

RedWithGreenXXXL = ".$_POST['RedGreenXXXL']."

RedWithBlueXXS = ".$_POST['RedBlueXXS']."

RedWithBlueXS = ".$_POST['RedBlueXS']."

RedWithBlueS = ".$_POST['RedBlueS']."

RedWithBlueM = ".$_POST['RedBlueM']."

RedWithBlueL = ".$_POST['RedBlueL']."

RedWithBlueXL = ".$_POST['RedBlueXL']."

RedWithBlueXXL = ".$_POST['RedBlueXXL']."

RedWithBlueXXXL = ".$_POST['RedBlueXXXL']."

RedWithWhiteXXS = ".$_POST['RedWhiteXXS']."

RedWithWhiteXS = ".$_POST['RedWhiteXS']."

RedWithWhiteS = ".$_POST['RedWhiteS']."

RedWithWhiteM = ".$_POST['RedWhiteM']."

RedWithWhiteL = ".$_POST['RedWhiteL']."

RedWithWhiteXL = ".$_POST['RedWhiteXL']."

RedWithWhiteXXL = ".$_POST['RedWhiteXXL']."

RedWithWhiteXXXL = ".$_POST['RedWhiteXXXL'];

mail ( $email, $subject, $message, "From:".$from );

Print "your message has been sent";

?>

The part that strings together on one line when any real info is put in is this.

$message=$_POST['']."

Company Name = ".$_POST['CompanyName']."

Company Address = ".$_POST['CompanyAddress']."

Company Phone = ".$_POST['CompanyPhone']."

Company Email = ".$_POST['CompanyEmail']."

Company Website = ".$_POST['URL']."

Contact Name = ".$_POST['ContactName']."

Contact Phone = ".$_POST['ContactPhone']."

Sender = ".$_POST['Sender']."

Is there some kind of html or php checking that is blowing things up on me when I enter a real address and company name??

Thanks again, Scott

347
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Mentor , Apr 26, 2017 Apr 26, 2017

You need to explicitly tell the process that the email should be sent as HTML

Content-type: text/html

Translate
Mentor ,
Apr 26, 2017 Apr 26, 2017
LATEST

You need to explicitly tell the process that the email should be sent as HTML

Content-type: text/html

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines