Click here to Skip to main content
15,992,684 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i'm trying to get data php $_GET function
It's my code
PHP
$logs = mysqli_real_escape_string($con, $_GET['logs']);

if i call my php script like http://website.com/myfile.php?id=1&logs=ABC&DEF

DEF charecters not showing. Is there any way to tell to script that string isn't finished at ABC

Sorry for my english Thanks
Posted

1 solution

There are two ways to deal with this. The first is to encode the URL correctly so that the '&' character is converted to '%26'. You can use the PHP urlencode[^] function, or in Javascript you can use encodeURIComponent[^]. PHP will automatically decode the '%26' back into '&' before placing it in $_GET.

The second way is to parse the whole of the query string yourself, which you might have to do if you have no control over the data passed to your script. You can find the contents of the query string in $_SERVER['QUERY_STRING'].
 
Share this answer
 

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