I'm trying to create a query string, which passes all form elements and the entered data via a GET request to a PHP file.
I'm using encodeURIComponent
in JavaScript to encode the input field names as well as the field values.
What I'm encountering is that the field values seem to be passed well as I receive them in $GET correctly, but the field names will have the dot (.) replaced by an underscore ().
Example:
<input type="text" name="form.0.text.0" value="" />
This field.name would arrive at my PHP script as form_0_text_0
instead of form.0.text.0
, while the entered text (e.g. this contains a lot of ....
) would arrive just fine.
I'm using the following code as part of the query string generation:
+ encodeURIComponent(field.name) + "=" + (field.type == "checkbox" ? (field.checked) : encodeURIComponent(field.value))
Any ideas about what to do?