I need to perform some very specific checks on a form, so I call a JS function on the submit and, if everything is ok, I call the "submit" method of that form using JS.
<form id="booking" action="booking.php" method="get">
<input name="Name *" type="text">
<input onclick="if (allOk()) document.forms['booking'].submit();
return false;" type="submit" value="booknow">
</form>
This is the generated URL
booking.php?Name+*=marco
but...
print_r($_GET);
...
Array ( [Name_*] => marco )
I need to know how can I get the original name of the element, Name * in this particular case, from the Name_*
Why is there an underscore, where there should be a space?
I tried urldecode, rawurldecode, and some others but it is still not working. Is it because you cannot use spaces in the GET elements? Will it be safe to simply replace each underscore with a space?
I never had any problems encoding/decoding GET/POST values, but it looks like I have problems when the field name has to be encoded/decoded too.
PS: I know I should use POST, but it has the exact same problem, and I switched back to GET to debug it faster.