当HTML表单被设置时,无法获取$ _POST变量值

-1 html php forms post

我希望得到文本输入'name ="quantity"'的值,当我的html表单是使用$ _POST设置时,问题是我每次提交表单时都无法获得它的价值!HTML:

<form method="POST" name="updateform">
<!-- the input text that i want to get it's value when the form is isset -->
 <input type="text" name="quantity" value="<?php echo $row['quantite'] ?>" size="1" class="form-control" />
<!-- the input text that i want to get it's value when the form is isset -->
<a type="submit" name="updateu" data-toggle="tooltip" title="Update" class="btn btn-primary" href='cart.php?id=<?php echo $getid ?>&upt=<?php echo $row['idproduit']; ?>' ><i class="fa fa-clone"></i></a>
                     </form> 
Run Code Online (Sandbox Code Playgroud)

PHP:

//update commande
           if (isset($_POST['updateform'])) {

              $mdf = $_POST['quantity'];
              echo $mdf;
           }else{
            echo "form not isset()";
           }
        //update commande
Run Code Online (Sandbox Code Playgroud)

它显示"形式没有设置"

任何解决方案,谢谢

Jay*_*ard 5

您不能使用锚标记作为表单的一部分,就像您在此处所做的那样:

<a type="submit" name="updateu" data-toggle="tooltip" title="Update" class="btn btn-primary" href='cart.php?id=<?php echo $getid ?>&upt=<?php echo $row['idproduit']; ?>' ><i class="fa fa-clone"></i></a>
Run Code Online (Sandbox Code Playgroud)

该链接永远不会成为post数组的一部分.您将需要一个名为的提交输入updateu,例如:

<input type="submit" name="updateu" ...
Run Code Online (Sandbox Code Playgroud)