我有一份申请表,可以将提交的用户详细信息转发给指定的电子邮件。这种形式的所有方面都可以正常工作。
但是,在表格开头有一个选项,询问您是否要添加联合申请人。此函数依赖于用另一个
替换数据数组if (isset($_SESSION['app1Title'])) {
$fields = array("app2Title", "app2FirstName", "app2Surname", "app2DOB", "app2Email", "app2Telephone", "app2Mobile", "app2MaritalStatus", "app2LicenceType");
define(TITLE,"Details about your joint applicant");
}
else {
$fields = array("app1Title", "app1FirstName", "app1Surname", "app1DOB", "app1Email", "app1Telephone", "app1Mobile", "app1MaritalStatus", "app1LicenceType", "rdoJointHirer");
define(TITLE,"Details about you");
}
然而,在完成表格后 - 尝试开始新的申请时,您可以直接与联合申请人分享#39;而不是从新鲜的
开始以下是提交后操作的代码。
// If everything is OK.
if (empty($error)) {
if (!isset($_SESSION['app1Title]'])) {
foreach ($_POST as $key => $field)
$_SESSION[$key] = $field;
if ($_POST['rdoJointHirer'] == "Yes") {
$_SESSION['return'] = "1";
header("Location: personal.php");
}
else
header("Location: address.php");
}
else {
foreach ($_POST as $key => $field)
$_SESSION[$key] = $field;
header("Location: address.php");
}
ob_end_clean();
exit();
}
else {
$values = post_values($fields); //Initialise all fields with their POST values
require('forms/personal-form.php');
}
}
}
else {
$values = blank_values($fields); //Initialise all fields as blank
require("forms/personal-form.php");
}
我该如何解决这个问题?