0

我对“条件条件”有疑问。这两个条件都取决于表单中的提交按钮。情况:用户点击第一个提交按钮->调用Class的3个方法->第三个方法“创建”另一个带有另一个提交按钮的表单。这个提交按钮是第二个重要条件的主题。当按下第二个提交按钮时,有 2 个方法被调用。但什么也没发生。第四种方法和第五种方法应在前面方法的基础上进行。我该如何解决这个问题?我希望问题描述不会令人困惑。还有一个小代码示例。谢谢。

$c = new Class;

 if(isset($_POST['button'])) {
   $c->firstMethod();
   $c->secondMethod();

   if($c->thirdMethod() != false) {
     echo ".. the second form with submit button will be here ...";
   }

   if(isset($_POST['button_of_second_form'])) {
     $c->fourthMethod();
     $c->fifthMethod();
   }
 }
4

1 回答 1

0

I believe when the second form is submitted it will not pass from the first condition because first you are checking:

if(isset($_POST['button'])) {....

and inside this condition block you are checking the 2nd form. If you can include the hidden value of button in the 2nd form then it will get pass from the first condition but then you have to take care of the first & second method to not run.

于 2013-07-02T14:42:31.400 回答