lundi 8 octobre 2018

Selected option value is not displaying in email message

I can able to send email successfully but the selected value is not displaying in email message. $select is the one should be displayed. Please help me..

Code is as follows:

    if (isset($_POST['submit']) && isset($_POST['sendMail'] ) )
        {
            $select = $_POST['datanew[co_cd]'];

            $email = "example@gmail.com";
                    $message = '<tr> <td><h2><strong>Dear </strong>'.  $select.' 
                    <h3>We would like to update you about your transaction with below details. <br>
                                BL #'.$datanew[bl_no]."
                                Container #:  6PK<br>

                                Recent Updates as of " . date('F d,Y   h:i A') . " </h3></td><tr> " ;

                    $headers  = 'mime_content_type(filename)E-Version: 1.0' . "\r\n";
                    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
                    $headers .= "From: example@gmail.com" . "\r\n";
                    mail($email,"Worksheet",$message, $headers);
            }


        else{

        }

Code in view page:

<select class="form-control" name="datanew[co_cd]">
<option value="">Choose Client</option>
 <?php foreach($client as $clientrow) : 
                                if 
($transdbrow['co_cd']===$clientrow['co_cd']) {
echo '<option value="' . $clientrow['co_cd'] . '" selected>' . 
$clientrow['co_name'] . '</option>';
} 
else {
echo '<option value="' . $clientrow['co_cd'] . '">' . $clientrow['co_name'] 
. '</option>';
}
endforeach;

$client = $client;?>                            
</select>




Aucun commentaire:

Enregistrer un commentaire