输入值未显示在我的电子邮件中

时间:2018-10-10 03:22:48

标签: php codeigniter

电子邮件发送成功,但输入值未显示在电子邮件中。 $cargo是应显示的那个。请帮助我...

查看页面代码

<div class="col-lg-6 col-md-6 mt-3">
<label>Container Number</label>
<input type="text" class="form-control" name="<?php if (!$ifCntrDbExists) {echo 'cntr_no_edit_add[]';} else {echo 'cntr_no_new[]';} ?>" value="<?php echo $transdbrow['cntr_no'] . ' ' . $transdbrow['no_of_cntr'];?>">
</div>

代码如下:

    if (isset($_POST['submit']) && isset($_POST['sendMail']))
        {
            $select = $_POST['datanew']['co_cd'];
            $bill=$_POST['datanew']['bl_no'];
            $cargo=$_POST['transdbrow']['cntr_no']['transdbrow']['no_of_cntr'];



            $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 #: '.$bill."<br>
                                Container #:  ".$cargo."
                                <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{}

1 个答案:

答案 0 :(得分:0)

$ cargo 变量正在调用不存在的输入名称 'transdbrow '。

$cargo=$_POST['transdbrow']['cntr_no']['transdbrow']['no_of_cntr'];

您的代码应为

$cargo=$_POST['cntr_no_edit_add']; 

$cargo=$_POST['cntr_no_new'];