【问题标题】:How to make the " th " appear only once如何让“th”只出现一次
【发布时间】:2015-05-01 03:39:53
【问题描述】:

修订:

我的contractEmail.php中有这些:

if(isset($_POST['submit']) && $_POST['submit'] == 'Send') {

$size= sizeof($_POST['users']);
$i = 0;


$message = NULL;

//    $message = null;
for($i=0; $i<$size; $i++){


$userId = $_REQUEST['users'][$i];

$message .= mailContent($userId);


}

$to      = $_POST['email'];
$subject = 'This is a test';
$headers = 'From: xx@live.com.ph' . "\r\n" .
'Reply-To: xx@live.com.ph' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$headers  .= 'MIME-Version: 1.0' . "\r\n";
$headers  .= 'Content-Type: text/html; charset=ISO-8859-1\r\n';


mail($to, $subject, $message, $headers);
}

function mailContent($userId) {


$con=mysqli_connect("localhost","xx","xx","xx");
$stmt = "SELECT * from CV where idvisa = '$userId'";
$result = mysqli_query($con, $stmt);

$row=mysqli_fetch_array($result);

$fName = $row['fName'];
$lName = $row['lName'];
$visaNumber = $row['visanumber'];
$idNumber = $row['idnumber'];
$statusApp = $row['statusapp'];
$accntVisaPhotoPath = $row['accntVisaPhotoPath'];
$passportPath = $row['passportPath'];
$subdate = $row['subdate'];

$message = "<table>
            <tr>
            <th>Name</th><th>Visa Number</th><th>ID Number</th><th>Application Status</th><th>Visa Copy</th><th>Passport Copy</th><th>Date</th>
            </tr>" . "\r\n";
$message .= "<tr>
            <td>$fName $lName</td><td>$visaNumber</td><td>$idNumber</td><td>$statusApp</td><td>$accntVisaPhotoPath</td><td>$passportPath</td><td>$subdate</td>
            </tr>   
            </table>" . "\r\n";
  // OTHER LOGICS GO HERE

return $message;

}
echo "<center>You have sent CV(s) </b><br/><br/><br/><br/>YOU MAY NOW    CLOSE THIS WINDOW</center>";
?>

但问题是,它并不像预期的那样。 th 在电子邮件中重复最多 10 次。如何让 th 只出现一次?

这就是我想要的:

|  Name   |   Visa Number   | ID Number   |
| Jurie   |   09254352654   | 5674356747  |
| Alex    |   56756786797   | 5464654545  |

这是我的link

【问题讨论】:

    标签: php mysql datatable html-table html-email


    【解决方案1】:

    您在 11(表格行)中使用相同的变量。这就是在一封电子邮件中重复多达 10 个的原因。

    【讨论】:

    • 选择单框上的变量相同,一旦选中,邮件将发送到一个邮箱。
    • 它正在工作,但它有很多表头,最多 10 个。
    【解决方案2】:

    不要将select person 放在您的选择选项标签中。

    附言。你可以 var_dump($_POST['users']) 来检查。

    【讨论】:

    • 我有这些:array(10) { [0]=> string(2) "15" [1]=> string(2) "16" [2]=> string(0) "" [3]=> 字符串(0) "" [4]=> 字符串(0) "" [5]=> 字符串(0) "" [6]=> 字符串(0) "" [7]= > 字符串(0) "" [8]=> 字符串(0) "" [9]=> 字符串(0) "" }
    猜你喜欢
    • 2022-12-05
    • 1970-01-01
    • 2021-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多