2复选框以相同的名称发布?

时间:2016-10-01 12:26:50

标签: html checkbox

我该怎么办?研究“评论[]”据说以这种方式使用。我这样做时会出错

  

$ comment = post(“comment”);

           <input type="radio" value="1" name="comment">
           <label for="comment"> Yes</label>

           <input type="radio" value="2" name="comment">
           <label for="comment"> No</label>

1 个答案:

答案 0 :(得分:0)

HTML

<form action="your_php.php" method="post">
            <input type="radio" value="1" name="comment">
            <label for="comment"> Yes</label>

            <input type="radio" value="2" name="comment">
            <label for="comment"> No</label>

            <input type="submit" value="Submit" />  
    </form>

<强> your_php.php

    <?php
    if(isset($_POST["comment"])) {
            $comment = $_POST["comment"];
}
            print_r($comment);

            ?>
相关问题