选中的html表单框为NULL

时间:2016-07-13 15:43:32

标签: php html forms checkbox

我有一个表单,但是当检查这些内容时,只有Aggregation会将1作为值发布,其他的,即使在用户选中时也未发布。对于这些值,Entry.php只获得NULL。

form.html

    <form id="submit_entry" action="entry.php" method="post">

    <label for=dataFunc>What data functions does this organization/initiative provide? <br></label><br>
    <input type="checkbox" name="aggregation" value=1> Aggregation<br>

    <input type="checkbox" name="production" value=1> Production<br>

    <input type="checkbox" name="analysis" value=1> Analysis<br>

    <input type="checkbox" name="advocacy" value=1> Advocacy<br>

    <span = "submit><input type="submit"></span>
    </form>

entry.php

    <?php
    $aggregation = $_POST["aggregation"]; 
    $production = $POST_["production"];
    $advocacy = $POST_["advocacy"];
    $analysis = $POST_["analysis"];
    $type = gettype($aggregation);
    echo "  Aggregation: " . $aggregation . " is data type " . $type . "<br>";
    $type = gettype($production);
    echo "  Production: " . $production . " is data type " . $type . "<br>";
    $type = gettype($advocacy);
    echo "  Advocacy: " . $advocacy . " is data type " . $type . "<br>";
    $type = gettype($analysis);
    echo "  Analysis: " . $analysis . " is data type " . $type . "<br>";
    ?>
表格上的

enter image description here

来自处理帖子,echoed变量和gettype()

的结果

enter image description here

1 个答案:

答案 0 :(得分:0)

你在错误的地方有下划线:

--no-color

应该是:

                   ▼
$production = $POST_["production"];
$advocacy = $POST_["advocacy"];
$analysis = $POST_["analysis"];