单选按钮不能通过php获取

时间:2016-12-26 07:40:06

标签: php html forms post

所有我的表单变量都是由php收集的,只有一个不被收回:这里是HTML表单:

<form action="submit.php" method="post">
    <b>Nome</b><br>
    <input id='nome' name='nome' type='text' value="<?php echo $nome; ?>"><br>
    <b>Cognome</b><br>
    <input id='cognome' name='cognome' type='text' value="<?php echo $cognome; ?>"><br>
    <b>Data di Nascita</b><br>
    <input id='datepicker_disabled' name='nascita' placeholder="gg/mm/aaaa" type='text' value="<?php echo $data; ?>"><br>
    <b>Sesso</b><br>
    <input id='sesso' name='sesso' type='radio' value='Maschio'>Maschio<br>
    <input id='sesso' name='sesso' type='radio' value='Femmina'>Femmina<br>
    <br>
    <b>Allergie</b><br>
    <input id='allergie' name='allergie0' type='radio' value='si'>Si<br>
    <input id='allergie' name='allergie0' type='radio' value='no'>No<br>
    <br>
    <b>Se ha allergie, scrivere quali</b><br>
    <textarea name="allergie_text"><?php echo $allergie; ?></textarea><br>
    <br>
    <button type="submit"><?php echo $submit; ?></button>
</form>

我的php reciver是:

    $mode=$_GET["mode"];
    $idgenitore=$_SESSION["idgenitore"];
    $idfiglio=$_GET["id"];
    $nome=$_POST["nome"];
    $cognome=$_POST["cognome"];
    $data=$_POST["nascita"];
    $sesso=$_POST["sesso"];
    $allergie=$POST["allergie0"];
    $allergie_text=$_POST["allergie_text"];

    echo $allergie;

所以$ _POST [&#39; allergie0&#39;]总是空的,无法弄清楚为什么...... :(

0 个答案:

没有答案