如何制作" th"只出现一次

时间:2015-02-28 12:39:40

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

修:

我在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>";
?>

但问题是,它不是预期的。这是在重复10日的电子邮件中重复。如何让它只出现一次?

这就是我想要的:

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

这是我的link

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

请勿在您的select-option标记中添加select person

PS。你可以var_dump($ _ POST ['users'])签出。