有点奇怪(至少对我来说......)
我想让用户填写一个小表格,以便继续申请两种不同类型的财务(姓名、电子邮件、联系方式等)。用户还需要指定他们想要的财务类型,提交表单会将用户带到该财务类型的完整应用程序。我已经可以做到这一点。
我还希望将初始表格中给出的输入转移到完整的应用程序中。我也可以这样做。
我的问题是,我不能同时让这两个功能一起工作!
初始形式:
<form method="post" action="form.starterApp.php" name="applyStart" id="applyStart">
<table class="applyStart formTable" style="margin-right:20px;">
<tr>
<td colspan="2">
<label for="ddAppType">Would you like to apply for Car Finance or a Logbook Loan?</label><br />
<select name="ddAppType" id="ddAppType">
<option value="Car Finance">Car Finance</option>
<option value="Logbook Loan">Logbook Loan</option>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<label for="txtName">Your Name</label><br />
<input name="txtName" type="text" id="txtName" value="" />
</td>
</tr>
<tr>
<td colspan="2">
<label for="txtEmail">Your Email</label><br />
<input name="txtEmail" type="text" id="txtEmail" value="" />
</td>
</tr>
<tr>
<td colspan="2">
<label for="txtNumber">Your Contact Number</label><br />
<input name="txtNumber" type="text" id="txtNumber" value="" />
</td>
</tr>
<tr>
<td>
<label for="chkAge" class="chkAge">Are you over 18 years of age?</label>
</td>
<td>
<input type="checkbox" name="chkAge" id="chkAge" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" class="submit" id="submit" value="Submit" />
</td>
</tr>
</table>
</form>
动作脚本(form.starterApp.php):
<?php
if(!$_POST) exit;
// Only edit below this line if either instructed to do so by the author or have extensive PHP knowledge.
// Please Note, we cannot support this file package if modifications have been made below this line.
$ddAppType = $_POST['ddAppType'];
$txtName = $_POST['txtName'];
$chkAge = $_POST['chkAge'];
$txtEmail = $_POST['txtEmail'];
$txtNumber = $_POST['txtNumber'];
$ifFinance = 'apply-for-finance';
$ifLogbook = 'apply-for-logbook';
//Setting the Application Type
if ($ddAppType == 'Car Finance') {
$appType = $ifFinance;
}
else if ($ddAppType == 'Logbook Loan') {
$appType = $ifLogbook;
}
{
header( 'Location: '.$appType.'' );
}
?>
目标页面:
<form method="post" action="form.fullApplication.php" name="applyFinance" id="applyFinance">
<table class="applyFinance formTable" style="margin-right:20px;">
<tr>
<td colspan="2">
<label for="txtName">Your Name</label><br />
<input name="txtName" type="text" id="txtName" value="<?php echo $_POST["txtName"]; ?>" />
</td>
</tr>
<tr>
<td colspan="2">
<label for="txtEmail">Your Email</label><br />
<input name="txtEmail" type="text" id="txtEmail" value="" />
</td>
</tr>
<tr>
<td colspan="2">
<label for="txtNumber">Your Contact Number</label><br />
<input name="txtNumber" type="text" id="txtNumber" value="" />
</td>
</tr>
<tr>
<td>
<label for="chkAge" class="chkAge">Are you over 18 years of age?</label>
</td>
<td>
<input type="checkbox" name="chkAge" id="chkAge" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" class="submit" id="submit" value="Submit" />
</td>
</tr>
</table>
这是我第一次在这里发帖,如果我遗漏了任何明显的东西,请原谅我,我会尽我所能回答任何问题。
干杯!