Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9172081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:15:38+00:00 2026-06-17T16:15:38+00:00

I’ve created an online form where input data is sent via email using PHPMailer.

  • 0

I’ve created an online form where input data is sent via email using PHPMailer. The emails that I am currently receiving, however, show the variables rather than what users have actually typed into the form. Here is an example of an email I just received:

Account Name: $AccountName
Delivery To: $DeliveryTo
Order No: $OrderNo
Del Date: $DelDate
Builder Name: $BuilderName
Delivery Instructions: $DeliveryInstructions
Contact Phone: $ContactPhone

Note how even though I typed in something as the Account Name, Phone Number etc, the variable names ($AccountName, $ContactPhone) are being display, not the actual input. I have set these variables as you will see below, so I’m not sure why this is happening. Any help would be greatly appreciated.

In my mail.php:

<?php
    require("/home/ange/public_html/angelasmith.com.au/staging/PHPMailer_5.2.2/class.phpmailer.php");

    $AccountName = $_POST['AccountName'];
    $DeliveryTo = $_POST['DeliveryTo'];
    $OrderNo = $_POST['OrderNo'];
    $DelDate = $_POST['DelDate'];
    $BuilderName = $_POST['BuilderName'];
    $DeliveryInstructions = $_POST['DeliveryInstructions'];
    $ContactPhone = $_POST['ContactPhone'];
    $totalsheets = $_POST['totalsheets'];
    $totalsqm = $_POST['totalsqm'];

    $c15 = $_POST['c15'];
    $d15 = $_POST['d15'];
    $e15 = $_POST['e15'];
    $f15 = $_POST['f15'];
    $h15 = $_POST['h15'];
    $i15 = $_POST['i15'];
    $j15 = $_POST['j15'];
    $k15 = $_POST['k15'];
    $l15 = $_POST['l15'];
    $m15 = $_POST['m15'];

    $c16 = $_POST['c16'];
    $d16 = $_POST['d16'];
    $e16 = $_POST['e16'];
    $f16 = $_POST['f16'];
    $h16 = $_POST['h16'];
    $i16 = $_POST['i16'];
    $j16 = $_POST['j16'];
    $k16 = $_POST['k16'];
    $l16 = $_POST['l16'];
    $m16 = $_POST['m16'];

    $mail = new PHPMailer();

    $mail->IsSMTP();                                      // set mailer to use SMTP
    $mail->Host = "mail.mydomain.com.au";  // specify main and backup server
    $mail->Port = 25; 
    $mail->Username = "test@mydomain.com.au";  // SMTP username
    $mail->Password = "********"; // SMTP password

    $mail->From = "hello@mydomain.com.au";
    $mail->FromName = "*********";
    $mail->AddAddress("hello@mydomain.com.au");

                $mail->WordWrap = 50;                                 // set word wrap to 50 characters
                $mail->IsHTML(true);                                  // set email format to HTML

                $mail->Subject = "New Online Form Enquiry";

                $htmlBody = '<html>
                <head><title>Online Order Form</title></head><body>
                <p><b>Account Name:</b> $AccountName<br>
                <b>Delivery To:</b> $DeliveryTo<br>
                <b>Order No:</b> $OrderNo<br>
                <b>Del Date:</b> $DelDate<br>
                <b>Builder Name:</b> $BuilderName<br>
                <b>Delivery Instructions:</b> $DeliveryInstructions<br>
                <b>Contact Phone:</b> $ContactPhone<br>

                <table style="border:1px solid #ccc" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td><strong>1700</strong></td>
                        <td><strong>2100</strong></td>
                        <td><strong>3000</strong></td>
                        <td><strong>3600</strong></td>
                        <td><strong>4200</strong></td>
                        <td><strong>4800</strong></td>
                        <td><strong>5400</strong></td>
                        <td><strong>6000</strong></td>
                        <td>m2</td>
                        <td>Count</td>
                    </tr>

                    <tr>
                        <td><strong>10 RE</strong></td>
                        <td>1200</td>
                        <td>$c15</td>
                        <td>$d15</td>
                        <td>$e15</td>
                        <td>$f15</td>
                        <td>$h15</td>
                        <td>$i15</td>
                        <td>$j15</td>
                        <td>$k15</td>
                        <td>$l15</td>
                        <td>$m15</td>
                    </tr>

                    <tr>
                        <td><strong>10 RE</strong></td>
                        <td>1350</td>
                        <td>$c16</td>
                        <td>$d16</td>
                        <td>$e16</td>
                        <td>$f16</td>
                        <td>$h16</td>
                        <td>$i16</td>
                        <td>$j16</td>
                        <td>$k16</td>
                        <td>$l16</td>
                        <td>$m16</td>
                    </tr>

                    <tr>
                        <td><strong>Span</strong></td>
                        <td>1200</td>
                        <td>$c17</td>
                        <td>$d17</td>
                        <td>$e17</td>
                        <td>$f17</td>
                        <td>$h17</td>
                        <td>$i17</td>
                        <td>$j17</td>
                        <td>$k17</td>
                        <td>$l17</td>
                        <td>$m17</td>
                    </tr>

                    <tr>
                        <td><strong>Span</strong></td>
                        <td>1350</td>
                        <td>$c18</td>
                        <td>$d18</td>
                        <td>$e18</td>
                        <td>$f18</td>
                        <td>$h18</td>
                        <td>$i18</td>
                        <td>$j18</td>
                        <td>$k18</td>
                        <td>$l18</td>
                        <td>$m18</td>
                    </tr>

                    <tr>
                        <td><strong>13 RE</strong></td>
                        <td>1200</td>
                        <td>$c19</td>
                        <td>$d19</td>
                        <td>$e19</td>
                        <td>$f19</td>
                        <td>$h19</td>
                        <td>$i19</td>
                        <td>$j19</td>
                        <td>$k19</td>
                        <td>$l19</td>
                        <td>$m19</td>
                    </tr>

                    <tr>
                        <td><strong>13 RE</strong></td>
                        <td>1350</td>
                        <td>$c20</td>
                        <td>$d20</td>
                        <td>$e20</td>
                        <td>$f20</td>
                        <td>$h20</td>
                        <td>$i20</td>
                        <td>$j20</td>
                        <td>$k20</td>
                        <td>$l20</td>
                        <td>$m20</td>
                    </tr>

                    <tr>
                        <td><strong>10 WR</strong></td>
                        <td>1200</td>
                        <td>$c21</td>
                        <td>$d21</td>
                        <td>$e21</td>
                        <td>$f21</td>
                        <td>$h21</td>
                        <td>$i21</td>
                        <td>$j21</td>
                        <td>$k21</td>
                        <td>$l21</td>
                        <td>$m21</td>
                    </tr>

                    <tr>
                        <td><strong>10 WR</strong></td>
                        <td>1350</td>
                        <td>$c22</td>
                        <td>$d22</td>
                        <td>$e22</td>
                        <td>$f22</td>
                        <td>$h22</td>
                        <td>$i22</td>
                        <td>$j22</td>
                        <td>$k22</td>
                        <td>$l22</td>
                        <td>$m22</td>
                    </tr>

                    <tr>
                        <td><strong>13 WR</strong></td>
                        <td>1200</td>
                        <td>$c23</td>
                        <td>$d23</td>
                        <td>$e23</td>
                        <td>$f23</td>
                        <td>$h23</td>
                        <td>$i23</td>
                        <td>$j23</td>
                        <td>$k23</td>
                        <td>$l23</td>
                        <td>$m23</td>
                    </tr>

                    <tr>
                        <td><strong>Villaboard 6mm</strong></td>
                        <td>1200</td>
                        <td>$c24</td>
                        <td>$d24</td>
                        <td>$e24</td>
                        <td>$f24</td>
                        <td>$h24</td>
                        <td>$i24</td>
                        <td>$j24</td>
                        <td>$k24</td>
                        <td>$l24</td>
                        <td>$m24</td>
                    </tr>

                    <tr>
                        <td><strong>Villaboard 6mm</strong></td>
                        <td>1350</td>
                        <td>$c35</td>
                        <td>$d35</td>
                        <td>$e35</td>
                        <td>$f35</td>
                        <td>$h35</td>
                        <td>$i35</td>
                        <td>$j35</td>
                        <td>$k35</td>
                        <td>$l35</td>
                        <td>$m35</td>
                    </tr>


                </table>

                <p><h3>Total Sheet Count:</h3> $totalsheets<br>
                <h3>Total Square Metres:</h3> $totalsqm</p>

                ';

                $mail->Body = $htmlBody;
                $mail->AltBody = $textBody;

                if(!$mail->Send())
                {
                   echo "Message could not be sent. <p>";
                   echo "Mailer Error: " . $mail->ErrorInfo;
                   exit;
                }

                echo "Message has been sent";
                ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:15:39+00:00Added an answer on June 17, 2026 at 4:15 pm

    If you want to declare a string variable using single quotes, you just have to concatenate variables this way:

    $htmlBody = '<html>
        <head><title>Online Order Form</title></head><body>
        <p><b>Account Name:</b> '.$AccountName.'<br>
        <b>Delivery To:</b> '.$DeliveryTo.'<br>
        <b>Order No:</b> '.$OrderNo.'<br>
        <b>Del Date:</b> '.$DelDate.'<br>
        <b>Builder Name:</b> '.$BuilderName.'<br>
        <b>Delivery Instructions:</b> '.$DeliveryInstructions.'<br>
        <b>Contact Phone:</b> '.$ContactPhone.'<br>
        ...
        ';
    

    Otherwise you must declare your string variable using a double quotes if you want variables replaced by their values:

    $htmlBody = "<html>
        <head><title>Online Order Form</title></head><body>
        <p><b>Account Name:</b> $AccountName<br>
        <b>Delivery To:</b> $DeliveryTo<br>
        <b>Order No:</b> $OrderNo<br>
        <b>Del Date:</b> $DelDate<br>
        <b>Builder Name:</b> $BuilderName<br>
        <b>Delivery Instructions:</b> $DeliveryInstructions<br>
        <b>Contact Phone:</b> $ContactPhone<br>
        ...
        ";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am using jsonparser to parse data and images obtained from json response. When
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am using JSon response to parse title,date content and thumbnail images and place
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.