how to properly escape data with javascript for query string for decoding in PHP -


this question has answer here:

i'm trying create query string, passes form elements , entered data via request php file.

i'm using encodeuricomponent in javascript encode input field names field values.

what i'm encountering field values seem passed receive them in $get correctly, field names have dot (.) replaced underscore ().

example:

<input type="text" name="form.0.text.0" value="" /> 

this field.name arrive @ php script form_0_text_0 instead of form.0.text.0, while entered text (e.g. this contains lot of ....) arrive fine.

i'm using following code part of query string generation:

+ encodeuricomponent(field.name) + "=" + (field.type == "checkbox" ? (field.checked) : encodeuricomponent(field.value)) 

any ideas do?

this php “protecting you”. if try pass variables containing dots, they'll replaced underscores. see get php stop replacing '.' characters in $_get or $_post arrays?

there way around “protection” if must use dots in name attributes: https://stackoverflow.com/a/1939911/2397004


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -