valid value for name attribute in html

前端 未结 3 1583
盖世英雄少女心
盖世英雄少女心 2020-12-10 04:42

I use PHP to get radio button values from a html page. My html looks like this:




        
3条回答
  •  Happy的楠姐
    2020-12-10 05:04

    By HTML rules, the name attribute may have any value: it is declared with CDATA type. Do not confuse the with the references to attributes declared as having NAME type. See http://www.w3.org/TR/html4/interact/forms.html#adef-name-INPUT

    In the use of $POST[...] in PHP, you need to note this PHP rule: “Dots and spaces in variable names are converted to underscores. For example becomes $_REQUEST["a_b"].” See http://www.php.net/manual/en/language.variables.external.php

    So $_POST['1'] should work as is and does work, but instead of $_POST['1.1'] you need to write $_POST['1_1'].

提交回复
热议问题