So I have a form customers fill out. When they check a few checkboxes t150 (t8) through t440 (t45) they will get the intended version of the quote with all of the checked models included in the quote, but if they check one of the models in the t150(t8) through t440e(t45) AND the s5e, the quote will only show the information on the s5e. And idea why? Thanks in advanced. I've been racking my brain for two days on this, and just can't seem to find why this is happening.

QUOTE AREA CODE (WHERE THE ADMIN REPLIES WITH A QUOTE)

    <?php 

    $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
    $mysqli2 = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAMETWO);
    if (mysqli_connect_errno()) {
        printf("Connect Failed: %s\n", mysqli_connect_error());
    } else {
        $id = $_GET['id'];
        $sql = "SELECT * FROM tracker WHERE ID = $id";
        $res = mysqli_query($mysqli, $sql);
        $delete = "<form id=\"delete\" method=\"post\" action=\"delete.php\">\n<input type=\"hidden\" value=\"$id\" name=\"delete-id\" />\n<input type=\"submit\" value=\"Delete Entry\" />\n</form>";

        if ($res) {
            while ($newArray = mysqli_fetch_array($res, MYSQL_ASSOC)) {
                $id = $newArray['ID'];
                $name = stripslashes($newArray['Name']);
                $email = $newArray['Email'];
                $address = $newArray['Address'];
                $city = $newArray['City'];
                $state = $newArray['State'];
                $zip = $newArray['Zip'];
                $telephone = $newArray['Telephone'];
                $source = $newArray['Source'];
                $t150 = $newArray['T150'];
                $qt150 = $newArray['QT150'];
                $t170 = $newArray['T170'];
                $qt170 = $newArray['QT170'];
                $t170e = $newArray['T170E'];
                $qt170e = $newArray['QT170E'];
                $t220 = $newArray['T220'];
                $qt220 = $newArray['QT220'];
                $t220e = $newArray['T220E'];
                $qt220e = $newArray['QT220E'];
                $t220x = $newArray['T220X'];
                $qt220x = $newArray['QT220X'];
                $t220ex = $newArray['T220EX'];
                $qt220ex = $newArray['QT220EX'];
                $t360 = $newArray['T360'];
                $qt360 = $newArray['QT360'];
                $t360e = $newArray['T360E'];
                $qt360e = $newArray['QT360E'];
                $t440 = $newArray['T440'];
                $qt440 = $newArray['QT440'];
                $t440e = $newArray['T440E'];
                $qt440e = $newArray['QT440E'];
                $s5e = $newArray['s5e'];
                $qts5e = $newArray['QTS5E'];
                $local = $newArray['LocalPickup'];
                $terminal = $newArray['Terminal'];
                $business1 = $newArray['Business1'];
                $business2 = $newArray['Business2'];
                $curbside = $newArray['Curbside'];
                $comments = $newArray['Comments'];
                $reply = $newArray['Reply'];
                $date = $newArray['Date'];
                //$reply_comments = $newArray['reply_comments'];
                $t150_quote_terminal = $newArray['t150-quote-terminal'];
                $t150_quote_business = $newArray['t150-quote-business'];
                $t150_quote_residence = $newArray['t150-quote-residence'];
                $t170_quote_terminal = $newArray['t170-quote-terminal'];
                $t170_quote_business = $newArray['t170-quote-business'];
                $t170_quote_residence = $newArray['t170-quote-residence'];
                $t170e_quote_terminal = $newArray['t170e-quote-terminal'];
                $t170e_quote_business = $newArray['t170e-quote-business'];
                $t170e_quote_residence = $newArray['t170e-quote-residence'];
                $t220_quote_terminal = $newArray['t220-quote-terminal'];
                $t220_quote_business = $newArray['t220-quote-business'];
                $t220_quote_residence = $newArray['t220-quote-residence'];
                $t220e_quote_terminal = $newArray['t220e-quote-terminal'];
                $t220e_quote_business = $newArray['t220e-quote-business'];
                $t220e_quote_residence = $newArray['t220e-quote-residence'];
                $t220x_quote_terminal = $newArray['t220x-quote-terminal'];
                $t220x_quote_business = $newArray['t220x-quote-business'];
                $t220x_quote_residence = $newArray['t220x-quote-residence'];
                $t220ex_quote_terminal = $newArray['t220ex-quote-terminal'];
                $t220ex_quote_business = $newArray['t220ex-quote-business'];
                $t220ex_quote_residence = $newArray['t220ex-quote-residence'];
                $t360_quote_terminal = $newArray['t360-quote-terminal'];
                $t360_quote_business = $newArray['t360-quote-business'];
                $t360_quote_residence = $newArray['t360-quote-residence'];
                $t360e_quote_terminal = $newArray['t360e-quote-terminal'];
                $t360e_quote_business = $newArray['t360e-quote-business'];
                $t360e_quote_residence = $newArray['t360e-quote-residence'];
                $t440_quote_terminal = $newArray['t440-quote-terminal'];
                $t440_quote_business = $newArray['t440-quote-business'];
                $t440_quote_residence = $newArray['t440-quote-residence'];              

    //BEGIN SMALL SAFES
            $s5e_quote_residence = $newArray['s5e_quote_residence'];
                $s5e_quote_terminal = $newArray['s5e_quote_terminal'];
                $s5e_quote_business = $newArray['s5e_quote_business'];      

        }

    $model = "";
    $model_quote = "";

    if (!empty($t150)) 
        {$model = "Shipping quote for $qt150 of Model T8.<br />";}

    if (!empty($t170)) 
        {$model = $model . "Shipping quote for $qt170 of Model T14.<br />";}
    if (!empty($t170e)) 
        {$model = $model . "Shipping quote for $qt170e of Model T14-E.<br />";}

    if (!empty($t220)) 
        {$model = $model . "Shipping quote for $qt220 of Model T24.<br />";}
    if (!empty($t220e)) 
        {$model = $model . "Shipping quote for $qt220e of Model T24-E.<br />";}
    if (!empty($t220x)) 
        {$model = $model . "Shipping quote for $qt220x of Model T24-X.<br />";}
    if (!empty($t220ex)) 
        {$model = $model . "Shipping quote for $qt220ex of Model T24-EX.<br />";}

    if (!empty($t360)) 
        {$model = $model . "Shipping quote for $qt360 of Model T36.<br />";}

    if (!empty($t360e)) 
        {$model = $model . "Shipping quote for $qt360e of Model T36-E.<br />";}

    if (!empty($t440)) 
        {$model = $model . "Shipping quote for $qt440 of Model T45.<br />";}
    if (!empty($t440e)) 
        {$model = $model . "Shipping quote for $qt440e of Model T45-E.<br />";}

    //BEGIN SMALL SAFES 
    if (!empty($s5e)) 
        {$model = $model . "Shipping quote for $qts5e of Model S5-E.<br />";}

    if (!empty($s8e)) 
        {$model = $model . "Shipping quote for $qts8e of Model S8-E.<br />";}

    if (!empty($s10b)) 
        {$model = $model . "Shipping quote for $qts10b of Model S10-B.<br />";}

    if (!empty($s12b)) 
        {$model = $model . "Shipping quote for $qts12b of Model S12-B.<br />";}

    if (!empty($s22e)) 
        {$model = $model . "Shipping quote for $qts22e of Model S22-E.<br />";}

    if (!empty($d20e)) 
        {$model = $model . "Shipping quote for $qtd20e of Model D20-E.<br />";}

    if ($model == "")
        {$model = "$name did not specify a model or quantity.<br />";}

            $ordered_model = "";

            if (!empty($t150)) 
                {$ordered_model = "<div class=\"terminal\"><label for=\"t150-quote-terminal\">Quote on $qt150 of T8 for Terminal: </label><input type=\"text\" name=\"t150-quote-terminal\" id=\"t150-quote-terminal\" value=\"\$\" /></div>\n<div><label for=\"t150-quote-business\">Quote on $qt150 of T8 for Business (with fork truck): </label><input type=\"text\" name=\"t150-quote-business\" id=\"t150-quote-business\" value=\"\$\" /></div>\n<div><label for=\"t150-quote-business1\">Quote on $qt150 of T8 for Business (without fork truck): </label><input type=\"text\" name=\"t150-quote-business1\" id=\"t150-quote-business1\" value=\"\$\" /></div>\n<div><label for=\"t150-quote-residence\">Quote on $qt150 of T8 for Residence: </label><input type=\"text\" name=\"t150-quote-residence\" id=\"t150-quote-residence\" value=\"\$\" /></div><hr />";}

            if (!empty($t170)) 
                {$ordered_model = $ordered_model . "<div class=\"terminal\"><label for=\"t170-quote-terminal\">Quote on $qt170 of T14 for Terminal: </label><input type=\"text\" name=\"t170-quote-terminal\" id=\"t170-quote-terminal\" value=\"\$\" /></div>\n<div><label for=\"t170-quote-business\">Quote on $qt170 of T14 for Business (with fork truck): </label><input type=\"text\" name=\"t170-quote-business\" id=\"t170-quote-business\" value=\"\$\" /></div>\n<div><label for=\"t170-quote-business1\">Quote on $qt170 of T14 for Business (without fork truck): </label><input type=\"text\" name=\"t170-quote-business1\" id=\"t170-quote-business1\" value=\"\$\" /></div>\n<div><label for=\"t170-quote-residence\">Quote on $qt170 of T14 for Residence: </label><input type=\"text\" name=\"t170-quote-residence\" id=\"t170-quote-residence\" value=\"\$\" /></div><hr />";}
            if (!empty($t170e)) 
                {$ordered_model = $ordered_model . "<div class=\"terminal\"><label for=\"t170e-quote-terminal\">Quote on $qt170e of T14-E for Terminal: </label><input type=\"text\" name=\"t170e-quote-terminal\" value=\"\$\" /></div>\n<div><label for=\"t170e-quote-business\">Quote on $qt170e of T14-E for Business (with fork truck): </label><input type=\"text\" name=\"t170e-quote-business\" value=\"\$\" /></div>\n<div><label for=\"t170e-quote-business1\">Quote on $qt170e of T14-E for Business (without fork truck): </label><input type=\"text\" name=\"t170e-quote-business1\" value=\"\$\" /></div>\n<div><label for=\"t170e-quote-residence\">Quote on $qt170e of T14-E for Residence: </label><input type=\"text\" name=\"t170e-quote-residence\" value=\"\$\" /></div><hr />";}

            if (!empty($t220)) 
                {$ordered_model = $ordered_model . "<div class=\"terminal\"><label for=\"t220-quote-terminal\">Quote on $qt220 of T24 for Terminal: </label><input type=\"text\" name=\"t220-quote-terminal\" value=\"\$\" /></div>\n<div><label for=\"t220-quote-business\">Quote on $qt220 of T24 for Business (with fork truck): </label><input type=\"text\" name=\"t220-quote-business\" value=\"\$\" /></div>\n<div><label for=\"t220-quote-business1\">Quote on $qt220 of T24 for Business (without fork truck): </label><input type=\"text\" name=\"t220-quote-business1\" value=\"\$\" /></div>\n<div><label for=\"t220-quote-residence\">Quote on $qt220 of T24 for Residence: </label><input type=\"text\" name=\"t220-quote-residence\" value=\"\$\" /></div><hr />";}
            if (!empty($t220e)) 
                {$ordered_model = $ordered_model . "<div class=\"terminal\"><label for=\"t220e-quote-terminal\">Quote on $qt220e of T24-E for Terminal: </label><input type=\"text\" name=\"t220e-quote-terminal\" value=\"\$\" /></div>\n<div><label for=\"t220e-quote-business\">Quote on $qt220e of T24-E for Business (with fork truck): </label><input type=\"text\" name=\"t220e-quote-business\" value=\"\$\" /></div>\n<div><label for=\"t220e-quote-business1\">Quote on $qt220e of T24-E for Business (without fork truck): </label><input type=\"text\" name=\"t220e-quote-business1\" value=\"\$\" /></div>\n<div><label for=\"t220e-quote-residence\">Quote on $qt220e of T24-E for Residence: </label><input type=\"text\" name=\"t220e-quote-residence\" value=\"\$\" /></div><hr />";}
            if (!empty($t220x)) 
                {$ordered_model = $ordered_model . "<div class=\"terminal\"><label for=\"t220x-quote-terminal\">Quote on $qt220x of T24-X for Terminal: </label><input type=\"text\" name=\"t220x-quote-terminal\" value=\"\$\" /></div>\n<div><label for=\"t220x-quote-business\">Quote on $qt220x of T24-X for Business (with fork truck): </label><input type=\"text\" name=\"t220x-quote-business\" value=\"\$\" /></div>\n<div><label for=\"t220x-quote-business1\">Quote on $qt220x of T24-X for Business (without fork truck): </label><input type=\"text\" name=\"t220x-quote-business1\" value=\"\$\" /></div>\n<div><label for=\"t220x-quote-residence\">Quote on $qt220x of T24-X for Residence: </label><input type=\"text\" name=\"t220x-quote-residence\" value=\"\$\" /></div><hr />";}
            if (!empty($t220ex)) 
                {$ordered_model = $ordered_model . "<div class=\"terminal\"><label for=\"t220ex-quote-terminal\">Quote on $qt220ex of T24-EX for Terminal: </label><input type=\"text\" name=\"t220ex-quote-terminal\" value=\"\$\" /></div>\n<div><label for=\"t220ex-quote-business\">Quote on $qt220ex of T24-EX for Business (with fork truck): </label><input type=\"text\" name=\"t220ex-quote-business\" value=\"\$\" /></div>\n<div><label for=\"t220ex-quote-business1\">Quote on $qt220ex of T24-EX for Business (without fork truck): </label><input type=\"text\" name=\"t220ex-quote-business1\" value=\"\$\" /></div>\n<div><label for=\"t220ex-quote-residence\">Quote on $qt220ex of T24-EX for Residence: </label><input type=\"text\" name=\"t220ex-quote-residence\" value=\"\$\" /></div><hr />";}

            if (!empty($t360)) 
                {$ordered_model = $ordered_model . "<div class=\"terminal\"><label for=\"t360-quote-terminal\">Quote on $qt360 of T36 for Terminal: </label><input type=\"text\" name=\"t360-quote-terminal\" value=\"\$\" /></div>\n<div><label for=\"t360-quote-business\">Quote on $qt360 of T36 for Business (with fork truck): </label><input type=\"text\" name=\"t360-quote-business\" value=\"\$\" /></div>\n<div><label for=\"t360-quote-business1\">Quote on $qt360 of T36 for Business (without fork truck): </label><input type=\"text\" name=\"t360-quote-business1\" value=\"\$\" /></div>\n<div><label for=\"t360-quote-residence\">Quote on $qt360 of T36 for Residence: </label><input type=\"text\" name=\"t360-quote-residence\" value=\"\$\" /></div><hr />";}

            if (!empty($t360e)) 
                {$ordered_model = $ordered_model . "<div class=\"terminal\"><label for=\"t360e-quote-terminal\">Quote on $qt360e of T36-E for Terminal: </label><input type=\"text\" name=\"t360e-quote-terminal\" value=\"\$\" /></div>\n<div><label for=\"t360e-quote-business\">Quote on $qt360e of T36-E for Business (with fork truck): </label><input type=\"text\" name=\"t360e-quote-business\" value=\"\$\" /></div>\n<div><label for=\"t360e-quote-business1\">Quote on $qt360e of T36-E for Business (without fork truck): </label><input type=\"text\" name=\"t360e-quote-business1\" value=\"\$\" /></div>\n<div><label for=\"t360e-quote-residence\">Quote on $qt360e of T36-E for Residence: </label><input type=\"text\" name=\"t360e-quote-residence\" value=\"\$\" /></div><hr />";}

            if (!empty($t440)) 
                {$ordered_model = $ordered_model . "<div class=\"terminal\"><label for=\"t440-quote-terminal\">Quote on $qt440 of T45 for Terminal: </label><input type=\"text\" name=\"t440-quote-terminal\" value=\"\$\" /></div>\n<div><label for=\"t440-quote-business\">Quote on $qt440 of T45 for Business (with fork truck): </label><input type=\"text\" name=\"t440-quote-business\" value=\"\$\" /></div>\n<div><label for=\"t440-quote-business1\">Quote on $qt440 of T45 for Business (without fork truck): </label><input type=\"text\" name=\"t440-quote-business1\" value=\"\$\" /></div>\n<div><label for=\"t440-quote-residence\">Quote on $qt440 of T45 for Residence: </label><input type=\"text\" name=\"t440-quote-residence\" value=\"\$\" /></div><hr />";}
            if (!empty($t440e)) 
                {$ordered_model = $ordered_model . "<div class=\"terminal\"><label for=\"t440e-quote-terminal\">Quote on $qt440e of T45-E for Terminal: </label><input type=\"text\" name=\"t440e-quote-terminal\" value=\"\$\" /></div>\n<div><label for=\"t440e-quote-business\">Quote on $qt440e of T45-E for Business (with fork truck): </label><input type=\"text\" name=\"t440e-quote-business\" value=\"\$\" /></div>\n<div><label for=\"t440e-quote-business1\">Quote on $qt440e of T45-E for Business (without fork truck): </label><input type=\"text\" name=\"t440e-quote-business1\" value=\"\$\" /></div>\n<div><label for=\"t440e-quote-residence\">Quote on $qt440e of T45-E for Residence: </label><input type=\"text\" name=\"t440e-quote-residence\" value=\"\$\" /></div><hr />";}

    //BEGIN SMALL SAFES
            if (!empty($s5e)) 
                {$ordered_model = $ordered_model . "<div class=\"terminal\"><label for=\"s5e_quote_terminal\">Quote on $qts5e of S5-E for Terminal: </label><input type=\"text\" name=\"s5e_quote_terminal\" value=\"\$\" /></div>\n<div><label for=\"s5e_quote_business\">Quote on $qts5e of s5-E for Business (with fork truck): </label><input type=\"text\" name=\"s5e_quote_business\" value=\"\$\" /></div>\n<div><label for=\"s5e_quote_business1\">Quote on $qts5e of S5-E for Business (without fork truck): </label><input type=\"text\" name=\"s5e_quote_business1\" value=\"\$\" /></div>\n<div><label for=\"s5e_quote_residence\">Quote on $qts5e of S5-E for Residence: </label><input type=\"text\" name=\"s5e_quote_residence\" value=\"\$\" /></div><hr />";}

            if ($ordered_model !== "")
            //The options under the select area is where you can change the names for the responders to the shipping request    
                {
                    // database table
                    $table = "users";
                    $colName = "name";
                    // get users from the database
                        if ($resMembers = $mysqli2->query("SELECT $colName FROM $table WHERE (user_id <= '3' OR user_id >= '12')"))
                                    { 
                                        if ($resMembers->num_rows > 0)
                                            {
                                                $option_block = '';
                                                while ($row = $resMembers->fetch_object())
                                                {
                                                    $option_block .= '<OPTION  value="'.$row->name.'">'.$row->name.'</OPTION>'; 
                                                }
                                            }
                                    }

                    $ordered_model = $ordered_model . "<div><p><label for=\"terminal_name\">Terminal Name: </label><input type=\"text\" name=\"terminal_name\" id=\"terminal_name\" /></p><p><label for=\"terminal_location\">Terminal Location: </label><input type=\"text\" name=\"terminal_location\" id=\"terminal_location\" /></p><p><label for=\"estimated_time\">Estimated Delivery Time: </label><input type=\"text\" name=\"estimated_time\" id=\"estimated_time\" /></p>
                <p><label for=\"reply_comments\">Reply Comments: </label><textarea id=\"reply_comments\" name=\"reply_comments\" cols=\"45\" rows=\"8\" aria-required=\"true\">


if ($ordered_model == "")
            {$ordered_model = "$name did not specify a model or quantity.<br />";}

        $shipping = "";

        if (!empty($local))
            {$shipping = "<br />Local Pickup";}
        if (!empty($terminal))
            {$shipping = $shipping . "<br />Terminal Pickup";}
        if (!empty($business1))
            {$shipping = $shipping . "<br />Business Delivery (Lift Gate Not Required)";}
        if (!empty($business2))
            {$shipping = $shipping . "<br />Business Delivery (Lift Gate Required)";}
        if (!empty($curbside))
            {$shipping = $shipping . "<br />Residential Delivery (Curbside)";}
        if (!empty($house))
            {$shipping = $shipping . "<br />In-House Delivery";}
        if ($shipping == "")
            {$shipping = "<br />No Shipping Method Selected.";}

    echo "<div>\n<p class=\"date\">".$date."</p>\n<p>".$name."<br />\n".$address."<br />\n".$city.", ".$state." ".$zip."</p>\n<p><a href=\"mailto:".$email."\">".$email."</a></p>\n<p>".$telephone."</p>\n<p><strong>Source: </strong>".$source."</p>\n<p>".$model."</p>\n<p><strong>Shipping Method(s):</strong>".$shipping."</p>\n<p>".$comments."</p>\n</div>";

    mysqli_close($mysqli);
}

Reply code

<?php 
require('config.php');
       // from the form newest version
       $id = trim(strip_tags($_POST['reply-id']));
       $status = trim(strip_tags($_POST['status']));       
       $t150_quote_terminal = trim(strip_tags($_POST['t150-quote-terminal']));
       $t150_quote_business = trim(strip_tags($_POST['t150-quote-business']));
       $t150_quote_business1 = trim(strip_tags($_POST['t150-quote-business1']));
       $t150_quote_residence = trim(strip_tags($_POST['t150-quote-residence']));

       $t170_quote_terminal = trim(strip_tags($_POST['t170-quote-terminal']));
       $t170_quote_business = trim(strip_tags($_POST['t170-quote-business']));
       $t170_quote_business1 = trim(strip_tags($_POST['t170-quote-business1']));
       $t170_quote_residence = trim(strip_tags($_POST['t170-quote-residence']));

       $t170e_quote_terminal = trim(strip_tags($_POST['t170e-quote-terminal']));
       $t170e_quote_business = trim(strip_tags($_POST['t170e-quote-business']));
       $t170e_quote_business1 = trim(strip_tags($_POST['t170e-quote-business1']));
       $t170e_quote_residence = trim(strip_tags($_POST['t170e-quote-residence'])); 

       $t220_quote_terminal = trim(strip_tags($_POST['t220-quote-terminal']));
       $t220_quote_business = trim(strip_tags($_POST['t220-quote-business']));
       $t220_quote_business1 = trim(strip_tags($_POST['t220-quote-business1']));
       $t220_quote_residence = trim(strip_tags($_POST['t220-quote-residence']));

       $t220e_quote_terminal = trim(strip_tags($_POST['t220e-quote-terminal']));
       $t220e_quote_business = trim(strip_tags($_POST['t220e-quote-business']));
       $t220e_quote_business1 = trim(strip_tags($_POST['t220e-quote-business1']));
       $t220e_quote_residence = trim(strip_tags($_POST['t220e-quote-residence']));

       $t220x_quote_terminal = trim(strip_tags($_POST['t220x-quote-terminal']));
       $t220x_quote_business = trim(strip_tags($_POST['t220x-quote-business']));
       $t220x_quote_business1 = trim(strip_tags($_POST['t220x-quote-business1']));
       $t220x_quote_residence = trim(strip_tags($_POST['t220x-quote-residence']));    

       $t220ex_quote_terminal = trim(strip_tags($_POST['t220ex-quote-terminal']));
       $t220ex_quote_business = trim(strip_tags($_POST['t220ex-quote-business']));
       $t220ex_quote_business1 = trim(strip_tags($_POST['t220ex-quote-business1']));
       $t220ex_quote_residence = trim(strip_tags($_POST['t220ex-quote-residence'])); 

       $t360_quote_terminal = trim(strip_tags($_POST['t360-quote-terminal']));
       $t360_quote_business = trim(strip_tags($_POST['t360-quote-business']));
       $t360_quote_business1 = trim(strip_tags($_POST['t360-quote-business1']));
       $t360_quote_residence = trim(strip_tags($_POST['t360-quote-residence']));

       $t360e_quote_terminal = trim(strip_tags($_POST['t360e-quote-terminal']));
       $t360e_quote_business = trim(strip_tags($_POST['t360e-quote-business']));
       $t360e_quote_business1 = trim(strip_tags($_POST['t360e-quote-business1']));
       $t360e_quote_residence = trim(strip_tags($_POST['t360e-quote-residence']));

       $t440_quote_terminal = trim(strip_tags($_POST['t440-quote-terminal']));
       $t440_quote_business = trim(strip_tags($_POST['t440-quote-business']));
       $t440_quote_business1 = trim(strip_tags($_POST['t440-quote-business1']));
       $t440_quote_residence = trim(strip_tags($_POST['t440-quote-residence']));

       $t440e_quote_terminal = trim(strip_tags($_POST['t440e-quote-terminal']));
       $t440e_quote_business = trim(strip_tags($_POST['t440e-quote-business']));
       $t440e_quote_business1 = trim(strip_tags($_POST['t440e-quote-business1']));
       $t440e_quote_residence = trim(strip_tags($_POST['t440e-quote-residence']));

       $s5e_quote_terminal = trim(strip_tags($_POST['s5e_quote_terminal']));
       $s5e_quote_business = trim(strip_tags($_POST['s5e_quote_business']));
       $s5e_quote_business1 = trim(strip_tags($_POST['s5e_quote_business1']));
       $s5e_quote_residence = trim(strip_tags($_POST['s5e_quote_residence']));

       $ups = $_POST['ups'];       
       $conway = $_POST['conway'];
       $yrc = $_POST['yrc'];
       $reddaway = $_POST['reddaway'];

       $terminal_name = trim(strip_tags($_POST['terminal_name']));
       $terminal_location = trim(strip_tags($_POST['terminal_location']));
       $estimated_time = trim(strip_tags($_POST['estimated_time']));
       $replier = trim(strip_tags($_POST['replier']));
       $reply_comments = trim(strip_tags($_POST['reply_comments']));
//Functions

function printInvoice($shipping_method, $model, $model_price, $qty, $shipping_amount, $total) {

$shipping_amount = str_replace("$", "", $shipping_amount);
settype($shipping_amount, "float");
    if (empty($shipping_amount)) {
        return false;
    }

    if ($shipping_amount === 0.01) {
        $shipping_amount = 0;
    }

settype($qty, "integer");

$total = $shipping_amount+($model_price*$qty);
settype($total, "float");

return "<tr><td>".$model."</td><td>".$shipping_method."</td><td>$".$model_price."</td><td>".$qty."</td><td>$".$shipping_amount."</td><td>$".$total."</td></tr>";
}

$invoice_header = "<table cellpadding=\"8\" class=\"invoice\"><tr><th><b>Model</b></th><th><b>Delivery Method</b></th><th><b>Price</b></th><th><b>Qty</b></th><th><b>Shipping</b></th><th><b>Total</b></th></tr>";   

       date_default_timezone_set('America/Los_Angeles');
       $the_date = date("g:ia, F j, Y");
       $reply_date = date("F j, Y");

// Connect to Database to store information

$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);

if (mysqli_connect_errno()) {
    printf("Connect Failed: %s\n", mysqli_connect_error());
    } else {

        $query = "SELECT * FROM tracker WHERE ID = $id";
    $fullres = mysqli_query($mysqli, $query);
    $newArray = mysqli_fetch_array($fullres, MYSQL_ASSOC);

            $name = $newArray['Name'];
            $email = $newArray['Email'];
            $address = $newArray['Address'];
            $city = $newArray['City'];
            $state = $newArray['State'];
            $zip = $newArray['Zip'];
            $telephone = $newArray['Telephone'];
            $source = $newArray['Source'];
            $t150 = $newArray['T150'];
            $qt150 = $newArray['QT150'];
            $t170 = $newArray['T170'];
            $qt170 = $newArray['QT170'];
            $t170e = $newArray['T170E'];
            $qt170e = $newArray['QT170E'];
            $t220 = $newArray['T220'];
            $qt220 = $newArray['QT220'];
            $t220e = $newArray['T220E'];
            $qt220e = $newArray['QT220E'];
            $t220x = $newArray['T220X'];
            $qt220x = $newArray['QT220X'];
            $t220ex = $newArray['T220EX'];
            $qt220ex = $newArray['QT220EX'];
            $t360 = $newArray['T360'];
            $qt360 = $newArray['QT360'];
            $t360e = $newArray['T360E'];
            $qt360e = $newArray['QT360E'];
            $t440 = $newArray['T440'];
            $qt440 = $newArray['QT440'];
            $t440e = $newArray['T440E'];
            $qt440e = $newArray['QT440E'];

//BEGIN SMALL SAFES
            $s5e = $newArray['s5e'];
            $qts5e = $newArray['QTS5E'];
            $local = $newArray['LocalPickup'];
            $terminal = $newArray['Terminal'];
            $business1 = $newArray['Business1'];
            $business2 = $newArray['Business2'];
            $curbside = $newArray['Curbside'];
            $comments = $newArray['Comments'];      
            $reply = $newArray['Reply'];
            $date = $newArray['Date'];
            //$reply_comments = $newArray['reply_comments'];



    mysqli_close($mysqli);
}


$model = "";
$model_quote = "";

if (!empty($t150)) 
    {$model = "Shipping quote for $qt150 of Model T8.<br />";
    $model_quote = printInvoice("Residential - Curbside/Garage", "T8", 399, $qt150, $t150_quote_residence, $total);
    $model_quote = $model_quote . printInvoice("Business - Lift Gate Required", "T8", 399, $qt150, $t150_quote_business1, $total);
    $model_quote = $model_quote . printInvoice("Business - No Lift Gate Required", "T8", 399, $qt150, $t150_quote_business, $total);
    $model_quote = $model_quote . printInvoice("Truck Terminal*", "T8", 399, $qt150, $t150_quote_terminal, $total);
    $model_quote = $model_quote . printInvoice("Warehouse Pickup - Vancouver, WA", "T8", 399, $qt150, 0.01, $total);
    $model_quote = $model_quote . "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
    }
if (!empty($t170)) 
    {$model = $model . "Shipping quote for $qt170 of Model T14.<br />";
    $model_quote = $model_quote . printInvoice("Residential - Curbside/Garage", "T14", 479, $qt170, $t170_quote_residence, $total);
    $model_quote = $model_quote . printInvoice("Business - Lift Gate Required", "T14", 479, $qt170, $t170_quote_business1, $total);
    $model_quote = $model_quote . printInvoice("Business - No Lift Gate Required", "T14", 479, $qt170, $t170_quote_business, $total);
    $model_quote = $model_quote . printInvoice("Truck Terminal*", "T14", 479, $qt170, $t170_quote_terminal, $total);
    $model_quote = $model_quote . printInvoice("Warehouse Pickup - Vancouver, WA", "T14", 479, $qt170, 0.01, $total);
    $model_quote = $model_quote . "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
    }
if (!empty($t170e)) 
    {$model = $model . "Shipping quote for $qt170e of Model T14-E.<br />";
    $model_quote = $model_quote . printInvoice("Residential - Curbside/Garage", "T14-E", 529, $qt170e, $t170e_quote_residence, $total);
    $model_quote = $model_quote . printInvoice("Business - Lift Gate Required", "T14-E", 529, $qt170e, $t170e_quote_business1, $total);
    $model_quote = $model_quote . printInvoice("Business - No Lift Gate Required", "T14-E", 529, $qt170e, $t170e_quote_business, $total);
    $model_quote = $model_quote . printInvoice("Truck Terminal*", "T14-E", 529, $qt170e, $t170e_quote_terminal, $total);
    $model_quote = $model_quote . printInvoice("Warehouse Pickup - Vancouver, WA", "T14-E", 529, $qt170e, 0.01, $total);
    $model_quote = $model_quote . "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
    }
if (!empty($t220)) 
    {$model = $model . "Shipping quote for $qt220 of Model T24.<br />";
    $model_quote = $model_quote . printInvoice("Residential - Curbside/Garage", "T24", 549, $qt220, $t220_quote_residence, $total);
    $model_quote = $model_quote . printInvoice("Business - Lift Gate Required", "T24", 549, $qt220, $t220_quote_business1, $total);
    $model_quote = $model_quote . printInvoice("Business - No Lift Gate Required", "T24", 549, $qt220, $t220_quote_business, $total);
    $model_quote = $model_quote . printInvoice("Truck Terminal*", "T24", 549, $qt220, $t220_quote_terminal, $total);
    $model_quote = $model_quote . printInvoice("Warehouse Pickup - Vancouver, WA", "T24", 549, $qt220, 0.01, $total);
    $model_quote = $model_quote . "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
    }
if (!empty($t220e)) 
    {$model = $model . "Shipping quote for $qt220e of Model T24-E.<br />";
    $model_quote = $model_quote . printInvoice("Residential - Curbside/Garage", "T24-E", 619, $qt220e, $t220e_quote_residence, $total);
    $model_quote = $model_quote . printInvoice("Business - Lift Gate Required", "T24-E", 619, $qt220e, $t220e_quote_business1, $total);
    $model_quote = $model_quote . printInvoice("Business - No Lift Gate Required", "T24-E", 619, $qt220e, $t220e_quote_business, $total);
    $model_quote = $model_quote . printInvoice("Truck Terminal*", "T24-E", 619, $qt220e, $t220e_quote_terminal, $total);
    $model_quote = $model_quote . printInvoice("Warehouse Pickup - Vancouver, WA", "T24-E", 619, $qt220e, 0.01, $total);
    $model_quote = $model_quote . "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
    }
if (!empty($t220x)) 
    {$model = $model . "Shipping quote for $qt220x of Model T24-X.<br />";
    $model_quote = $model_quote . printInvoice("Residential - Curbside/Garage", "T24-X", 599, $qt220x, $t220x_quote_residence, $total);
    $model_quote = $model_quote . printInvoice("Business - Lift Gate Required", "T24-X", 599, $qt220x, $t220x_quote_business1, $total);
    $model_quote = $model_quote . printInvoice("Business - No Lift Gate Required", "T24-X", 599, $qt220x, $t220x_quote_business, $total);
    $model_quote = $model_quote . printInvoice("Truck Terminal*", "T24-X", 599, $qt220x, $t220x_quote_terminal, $total);
    $model_quote = $model_quote . printInvoice("Warehouse Pickup - Vancouver, WA", "T24-X", 599, $qt220x, 0.01, $total);
    $model_quote = $model_quote . "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
    }
if (!empty($t220ex)) 
    {$model = $model . "Shipping quote for $qt220ex of Model T24-EX.<br />";
    $model_quote = $model_quote . printInvoice("Residential - Curbside/Garage", "T24-EX", 649, $qt220ex, $t220ex_quote_residence, $total);
    $model_quote = $model_quote . printInvoice("Business - Lift Gate Required", "T24-EX", 649, $qt220ex, $t220ex_quote_business1, $total);
    $model_quote = $model_quote . printInvoice("Business - No Lift Gate Required", "T24-EX", 649, $qt220ex, $t220ex_quote_business, $total);
    $model_quote = $model_quote . printInvoice("Truck Terminal*", "T24-EX", 649, $qt220ex, $t220ex_quote_terminal, $total);
    $model_quote = $model_quote . printInvoice("Warehouse Pickup - Vancouver, WA", "T24-EX", 649, $qt220ex, 0.01, $total);
    $model_quote = $model_quote . "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
    }

    if (!empty($t360)) 
    {$model = $model . "Shipping quote for $qt360 of Model T36.<br />";
    $model_quote = $model_quote . printInvoice("Residential - Curbside/Garage", "T36", 849, $qt360, $t360_quote_residence, $total);
    $model_quote = $model_quote . printInvoice("Business - Lift Gate Required", "T36", 849, $qt360, $t360_quote_business1, $total);
    $model_quote = $model_quote . printInvoice("Business - No Lift Gate Required", "T36", 849, $qt360, $t360_quote_business, $total);
    $model_quote = $model_quote . printInvoice("Truck Terminal*", "T36", 849, $qt360, $t360_quote_terminal, $total);
    $model_quote = $model_quote . printInvoice("Warehouse Pickup - Vancouver, WA", "T36", 849, $qt360, 0.01, $total);
    $model_quote = $model_quote . "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
    }

        if (!empty($t360e)) 
    {$model = $model . "Shipping quote for $qt360e of Model T36-E.<br />";
    $model_quote = $model_quote . printInvoice("Residential - Curbside/Garage", "T36-E", 919, $qt360e, $t360e_quote_residence, $total);
    $model_quote = $model_quote . printInvoice("Business - Lift Gate Required", "T36-E", 919, $qt360e, $t360e_quote_business1, $total);
    $model_quote = $model_quote . printInvoice("Business - No Lift Gate Required", "T36-E", 919, $qt360e, $t360e_quote_business, $total);
    $model_quote = $model_quote . printInvoice("Truck Terminal*", "T36-E", 919, $qt360e, $t360e_quote_terminal, $total);
    $model_quote = $model_quote . printInvoice("Warehouse Pickup - Vancouver, WA", "T36-E", 919, $qt360e, 0.01, $total);
    $model_quote = $model_quote . "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
    }


if (!empty($t440)) 
    {$model = $model . "Shipping quote for $qt440 of Model T45.<br />";
    $model_quote = $model_quote . printInvoice("Residential - Curbside/Garage", "T45", 1199, $qt440, $t440_quote_residence, $total);
    $model_quote = $model_quote . printInvoice("Business - Lift Gate Required", "T45", 1199, $qt440, $t440_quote_business1, $total);
    $model_quote = $model_quote . printInvoice("Business - No Lift Gate Required", "T45", 1199, $qt440, $t440_quote_business, $total);
    $model_quote = $model_quote . printInvoice("Truck Terminal*", "T45", 1199, $qt440, $t440_quote_terminal, $total);
    $model_quote = $model_quote . printInvoice("Warehouse Pickup - Vancouver, WA", "T45", 1199, $qt440, 0.01, $total);
    $model_quote = $model_quote . "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
    }
if (!empty($t440e)) 
    {$model = $model . "Shipping quote for $qt440e of Model T45-E.<br />";
    $model_quote = $model_quote . printInvoice("Residential - Curbside/Garage", "T45-E", 1279, $qt440e, $t440e_quote_residence, $total);
    $model_quote = $model_quote . printInvoice("Business - Lift Gate Required", "T45-E", 1279, $qt440e, $t440e_quote_business1, $total);
    $model_quote = $model_quote . printInvoice("Business - No Lift Gate Required", "T45-E", 1279, $qt440e, $t440e_quote_business, $total);
    $model_quote = $model_quote . printInvoice("Truck Terminal*", "T45-E", 1279, $qt440e, $t440e_quote_terminal, $total);
    $model_quote = $model_quote . printInvoice("Warehouse Pickup - Vancouver, WA", "T45-E", 1279, $qt440e, 0.01, $total);
    $model_quote = $model_quote . "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
    }

//BEGIN SMALL SAFES 
if (!empty($s5e)) 
    {$model = $model . "Shipping quote for $qts5e of Model S5-E.<br />";
    $model_quote = printInvoice("Residential - Curbside/Garage", "S5-E", 119, $qts5e, $s5e_quote_residence, $total);
    $model_quote = $model_quote . printInvoice("Business - Lift Gate Required", "S5-E", 119, $qts5e, $s5e_quote_business1, $total);
    $model_quote = $model_quote . printInvoice("Business - No Lift Gate Required", "S5-E", 119, $qts5e, $s5e_quote_business, $total);
    $model_quote = $model_quote . printInvoice("Truck Terminal*", "S5-E", 119, $qts5e, $s5e_quote_terminal, $total);
    $model_quote = $model_quote . printInvoice("Warehouse Pickup - Vancouver, WA", "S5-E", 119, $qts5e, 0.01, $total);
    $model_quote = $model_quote . "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
}


if ($model == "")
    {$model = "$name did not specify a model or quantity.<br />";}
    $model_quote = $model_quote . "</table>";

$shipping = "";

if (!empty($local))
    {$shipping = "<br />Local Pickup";}
if (!empty($terminal))
    {$shipping = $shipping . "<br />Terminal Pickup";}
if (!empty($business1))
    {$shipping = $shipping . "<br />Business Delivery (Lift Gate Not Required)";}
if (!empty($business2))
    {$shipping = $shipping . "<br />Business Delivery (Lift Gate Required)";}
if (!empty($curbside))
    {$shipping = $shipping . "<br />Residential Delivery (Curbside)";}
if (!empty($house))
    {$shipping = $shipping . "<br />In-House Delivery";}
if ($shipping == "")
    {$shipping = "<br />No Shipping Method Selected.";}

if ($terminal_name !== "" && $terminal_location !== "") {
    $terminal_info = "<p>*The quoted terminal price is for the $terminal_name terminal in $terminal_location.</p>";
} else {
    $terminal_info = "";
}

$name = stripslashes($name);

$reply = <<<EOT
<p>$name,</p>
<p>Thank you for your interest!</p>
$invoice_header
$terminal_info
<p>Transit time is $estimated_time business days. Please let me know if you have further questions.</p>
$model_quote
<p>Due to fluctuating cost of shipping charges that are beyond our control, this quote is valid for 15 business days unless stated otherwise.
We may contact you for additional information if necessary.Standard terms and conditions apply.</p> 

$reply_comments

<p>Thanks!</p>       

$replier

<p>$conway<br />$yrc<br />$reddaway<br />$ups</p>

EOT;

Recommended Answers

All 2 Replies

More or less guessing:

On line 276 (reply code) you have:

$model_quote = printInvoice("Residential - Curbside/Garage", "S5-E", 119, $qts5e, $s5e_quote_residence, $total);

Shouldn't it be:

$model_quote = $model_quote . printInvoice("Residential - Curbside/Garage", "S5-E", 119, $qts5e, $s5e_quote_residence, $total);

Seems like you are loosing all previous information here. But I might be wrong since it is hard to figure this out from this amount of code.

broj1,

THANK YOU SO MUCH! I knew it was something silly! This is why forums like this are the best because it always helps to get a fresh pair of eyes on your code when you are stuck like chuck!!!

Thanks, again! You rock.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.