Forum Moderators: coopster
I've got a bit of a problem that I would love some help with.
I am having problems parsing an HTML form that uses an radio buttons with an array for name:
<input type = 'radio' name = '".$link_results['name']."' value = '1'>
The issue seems to arise when $link_results['name'] has spaces in it. I have tried htmlsepecialchars and htmlentities to no avail.
When I reference $_POST[$link_results['name']] on the next page I do get the value of '1' on variables that do not contain spaces in the name. On variables that do contain spaces I get no result.
Anyone know whats up?
Control names and values are escaped. Space characters are replaced by `+', and then reserved characters are escaped as described in [RFC1738], section 2.2: Non-alphanumeric characters are replaced by `%HH', a percent sign and two hexadecimal digits representing the ASCII code of the character. Line breaks are represented as "CR LF" pairs (i.e., `%0D%0A').http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4
Last remark: TRY TO AVOID SPACE CHARACTER AS MUCH AS YOU CAN!
Edit:Added last remark ;)
Found under section 2:Note: Spaces in request variable names are converted to underscores.
I'm with tomda -- keep your name attributes in your forms as simple as possible and you will save yourself from all kinds of trouble.
My solution was to use this:
$_POST[str_replace(" ", "_", $results['name'])]
I realize that as far as programming protocol is concerned this isn't the best way to do it, but I am running with a really arcaic database.
Thanks for all your input
Whoops just finished reading your post coopster
thanks