Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi guys,

I am handling a scenario in PhP where the input is in %XXXXX% format, where XXXXX can be any number of characters/numbers. The input will be sent to sql for processing (the main intention is to send the input that contains %TEXT% to sql).

What I understand from the scenario is that the input text is being encoded as %257445D%25 and later it is decoded to t445D%. Here the value of ‘%74’ is ‘t’ and in this case any hexa decimal number followed by % gives the decoded form. Here is the ASCII encoding for reference " http://www.w3schools.com/tags/ref_urlencode.asp "

The ultimate goal is to get the output same as input. I dont want the input to be encoded and decoded.

Here is the piece of code:
form:
XML
<INPUT TYPE='text' name='name_1'  />\
              (ex:%7445% or %anything) \
              <INPUT TYPE='submit' name=name_pause_type value='Pause'>


Getting value:
$ss= $_GET['name_1'];




Please help me in getting raw data without encoding and decoding the value. I have tried using many scenario’s including the decoded version of htmlentities, utf8_encode, rawurlencode, using regex and replacing strings and many more.





Thank you!
Posted
Updated 22-Jan-15 16:20pm
v3
Comments
Mohibur Rashid 23-Jan-15 1:29am    
so, all you have to do is either encode %7445%, which would be %257445%25, properly or let the browser encode it. I have a feelings that you are trying to encode it but failing to do it or you are trying to connect with server like the following example
localhost/?name_1=%7445% and the browser is encoding it before it sends. If you are trying the later one then try as follow: localhost/?name_1=%257445%25, your php will get %7445%. Also try to understand the issue that we are submitting %7445% exactly in code project. Its not screwing up.
Shreekant kembhavi 23-Jan-15 4:29am    
In the url, it says name_1=%257445D%25 and it is decoded to name_1=t45D% the browser is encoding in this case.

I believe it is standard HTML/PHP processing. I am an amature php developer and stuck up with this. Please help me :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900