valid value for name attribute in html

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

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




        
相关标签:
3条回答
  • 2020-12-10 05:02

    This is easy to solve with a 2 second google search my friend. Also, you should name your input items with text, not numbers. They should not contain any characters such as .,!? This can cause problems. For more information submitting the data go to http://www.homeandlearn.co.uk/php/php4p10.html

    0 讨论(0)
  • 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 <input name="a.b" /> 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'].

    0 讨论(0)
  • 2020-12-10 05:11

    Try substituting the period for something else like a hyphen. In both the form and the php code. Periods are generally used for a . in the extension name. When it comes to key names for parameters in either get or post headers, you want to only use alphanumeric characters, with some special characters generally. Such as hyphens, underscores, etc. You can always do a URL encode if you need to as well.

    0 讨论(0)
提交回复
热议问题