php - Radio buttons checked however passing NULL to database -
i have 4 groups of radio buttons presented unchecked user. user needs check 1 radio button each group. when submit form, error that, example, picture_6.tif
value being passed null
.
i using codeigniter , form being submitted via post. wonder if tell me i'm doing wrong.
<form action="/log" method="post" accept-charset="utf-8"> <table class="static"> <tbody> <tr> <td><input type="radio" name="picture_6.tif" value="0" class=""></td> <td><input type="radio" name="picture_7.tif" value="0" class=""></td> <td><input type="radio" name="picture_8.tif" value="0" class=""></td> <td><input type="radio" name="picture_9.tif" value="0" class=""></td> </tr> <tr> <td><input type="radio" name="picture_6.tif" value="1" class=""></td> <td><input type="radio" name="picture_7.tif" value="1" class=""></td> <td><input type="radio" name="picture_8.tif" value="1" class=""></td> <td><input type="radio" name="picture_9.tif" value="1" class=""></td> </tr> <tr> <td><input type="radio" name="picture_6.tif" value="2" class=""></td> <td><input type="radio" name="picture_7.tif" value="2" class=""></td> <td><input type="radio" name="picture_8.tif" value="2" class=""></td> <td><input type="radio" name="picture_9.tif" value="2" class=""></td> </tr> <tr> <td><input type="radio" name="picture_6.tif" value="3" class=""></td> <td><input type="radio" name="picture_7.tif" value="3" class=""></td> <td><input type="radio" name="picture_8.tif" value="3" class=""></td> <td><input type="radio" name="picture_9.tif" value="3" class=""></td> </tr> <tr> <td><input type="radio" name="picture_6.tif" value="9" class=""></td> <td><input type="radio" name="picture_7.tif" value="9" class=""></td> <td><input type="radio" name="picture_8.tif" value="9" class=""></td> <td><input type="radio" name="picture_9.tif" value="9" class=""></td> </tr> </tbody> <tbody> <tr> <td> <div> <input type="submit" name="mysubmit" value="submit post!"> </div> </td> </tr> </tbody> </table> </form>
edit: adding make easier searching. error arises using periods in name
attribute.
you named radio
name="picture_6.tif"
, in php parameters available $_post["picture_6_tif"]
. note: not $_post["picture_6.tif"]
. latter null undefined.
<?php var_dump($_post); ?> //array(5) { ["picture_7_tif"]=> string(1) "1" ["picture_6_tif"]=> string(1) "2" ["picture_8_tif"]=> string(1) "3" ["picture_9_tif"]=> string(1) "9" ["mysubmit"]=> string(12) "submit post!" }
Comments
Post a Comment