我在一个页面上有五个表单:selectCategorySubmit,selectSoloSubmit,editSoloSubmit,selectGroupSubmit和editGroupSubmit。 我试图一次显示一个。当页面打开时,会显示第一个表单selectCategorySubmit,在提交之后,应该发生以下两种情况之一:
显示selectSoloSubmit表单,在提交后,将显示editSoloSubmit表单。
或
显示selectGroupSubmit表单,在提交后,将显示editGroupSubmit表单。
我遇到的问题是,当提交selectSoloSubmit或selectGroupSubmit表单时,它会返回并显示selectCategorySubmit表单。
我已尝试取出if(!isset($_POST['editSoloSubmit'])) {
和if(!isset($_POST['editGroupSubmit'])) {
if语句。
我也为这样的不同if语句尝试了多个条件:
if(!isset($_POST['editSoloLectureSubmit']) && !isset($_POST['selectSoloBiographySubmit']) && !isset($_POST['selectCategorySubmit'])) {
但这可能不会做任何事情,也不会出现未定义selectedCategory或selectedBiography的错误。
<?php
if(!isset($_POST['selectCategorySubmit'])) {
?>
<form action="editBiography.php" method="post">
<select name="selectedCategory" size="0">
<?php getCategoryList(); ?>
</select>
<input type="submit" name="selectCategorySubmit" value="Select Biography Category">
</form>
<?php
}
else {
$selectedCategory = $_POST['selectedCategory'];
if($selectedCategory == 'Solo Exhibition') {
if(!isset($_POST['selectSoloSubmit'])) {
?>
<form action="editBiography.php" method="post">
<select name="selectedBiography" size="0">
<?php getSoloList(); ?>
</select>
<input type="submit" name="selectSoloSubmit" value="Select Solo Exhibition">
</form>
<?php
}
else {
if(!isset($_POST['editSoloSubmit'])) {
$selectedBiography = $_POST['selectedBiography'];
$biography = getBiographyDetails($selectedBiography);
?>
<form action="editBiography.php" method="post">
<!-- Form fields go here -->
<input type="submit" name="editSoloSubmit" value="Edit Solo Exhibition">
</form>
<?php
}
}
}
else{
if(!isset($_POST['selectGroupSubmit'])) {
?>
<form action="editBiography.php" method="post">
<select name="selectedBiography" size="0">
<?php getGroupList(); ?>
</select>
<input type="submit" name="selectGroupSubmit" value="Select Group Exhibition">
</form>
<?php
}
else {
if(!isset($_POST['editGroupSubmit'])) {
$selectedBiography = $_POST['selectedBiography'];
$biography = getBiographyDetails($selectedBiography);
?>
<form action="editBiography.php" method="post">
<!-- Form fields go here -->
<input type="submit" name="editGroupSubmit" value="Edit Group Exhibition">
</form>
<?php
}
}
}
}
?>