Do elements in forms need to be a single word, either in totality or using an underscore, or can they have spaces?
A form name attribute may contain spaces, but you will find that in PHP the spaces (and periods) are replaced with underscores in the $_GET
/ $_POST
/ $_REQUEST
arrays:
<pre><?php var_dump($_REQUEST, $_GET, $_POST); ?></pre>
<form method="get">
<input name="This is a name" value="This is a value" />
<input type="submit" />
</form>
With either "get" or "post" methods, the input will be keyed This_is_a_name
.
Reference: PHP: Variables From External Sources (Note below example)
Space should not be used, as they are replaced by _
. You can use Underscore instead of space to avoid forceful replacement.
They need to be a single word, but can have numbers and underscores.
Yes, input in forms should be a single word. They can have underscores or numbers and they can also be Capital letters but there should be no space in the name you specify. Also make sure you don't enter special characters in name.