【发布时间】:2016-07-03 18:26:07
【问题描述】:
这是我正在处理的页面 http://grmaedu.com/application/
表单是使用名为 Visual Form Builder Pro 的 Wordpress 插件制作的。该表单运行良好,所有数据都很好地通过电子邮件发送到定义的电子邮件地址。提交时还会自动生成一个卷号。
现在我的问题是,我希望在表单“之后”显示的卷号与其他表单值一起通过电子邮件发送。这是我用来生成卷号的 php 代码:
<?php
/* Define Connection properties */
$servername = "localhost";
$username = "grmaedu_wp2";
$password = "*****";
$dbname = "grmaedu_wp2";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT entries_id FROM `wp_vfb_pro_entries` ORDER BY entries_id DESC LIMIT 1";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// get the last submitted id number
while ($row = mysqli_fetch_assoc($result)) {
$a = $row["entries_id"];
$a++; // add 1 to it for a new roll number
echo "<h3>Your Roll Number assigned is: " . $a . "</h3>";
}
} else {
echo "0 results";
}
mysqli_close($conn);
?>
我如何使以下特定代码与其他表单值一起提交并通过电子邮件发送?
echo "<h3>Your Roll Number assigned is: " . $a . "</h3>";
【问题讨论】: