dimanche 31 janvier 2016

if else as part of a concatenating string

I would like to include an if statement which would check if $plan has a particular value, and echo different values according to the value. This is part of a concatenating string, and I would like it to be at the position it is currently, rather than echoing at the before $message, as it is doing currently.

if ($_POST) {
    $name = $_POST['firstlastname'];
      others
            $plan = $_POST['plan'];
    /* plan 1*/
    $plan1_width = $_POST['plan1_width'];
    $plan1_length = $_POST['plan1_length'];     

    $empty = false;

            $message = "<html><body>".
            "<h3>Client Details</h3>".
            "<p><b>Name: </b>".$name."</p>".
            "<p><b>Email: </b>".$guest_email."</p>".
            "<p><b>Phone: </b>".$phone."</p>".
            "<p><b>Address: </b>".$address."</p>".
            "<p><b>City: </b>".$city."</p>".
            "<p><b>Postcode: </b>".$postcode."</p>".
            "<p><b>Country: </b>".$country."</p>".
            "<p><b>Comments: </b><br>".$comments."</p>".
            "<hr>".
            "<h3>Tiles Selected</h3>".
            $tiles.
            "<hr>".
            "<h3>Plan</h3>".
            "<p><b>Plan Selected: </b>".$plan."</p>".
            "<hr>";
            /* point of reference */
            if ($plan == "Enkel bankskiva")  {
                echo "<p><b>Width:</b> ".$plan1_width ."</p>".
                "<p><b>Length:</b>".$plan1_length ."</p>";
            } else  {
                echo "something else";
            }
            "</body></html>";

            $to = "christabelbusuttil@gmail.com"; //<== enter personal email here

                    // headers
            $headers = "From: $email_from \r\n";
            $headers .= "Reply-To: $guest_email \r\n";
            $headers .= "BCC: krista_126@hotmail.com\r\n";
            $headers .= "MIME-Version: 1.0\r\n";
            $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
            //Send the email!
            mail($to, $email_subject, $message, $headers);

            echo $email_subject ."<br>";
            echo $to ."<br>";
            echo $message ."<br>";
            echo $headers ."<br>"; 


        }
}

Aucun commentaire:

Enregistrer un commentaire