作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
修改:
我的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
最佳答案
您在 11(表行)中使用相同的变量。这就是在电子邮件中重复最多 10 次的原因。
关于php - 如何让 "th "只出现一次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28781801/
我是一名优秀的程序员,十分优秀!