HTML code `'` is breaking url after the code

457 Views Asked by At

I have an URL "www.yourdomain.com?caption=mycaption'goes here&title=mytitle" which is GET request.
But when I print $_GET array it prints only:
Array ( [caption] => mycaption )

I want: "mycaption'goes here" to be get fetched as it is from URL(using $_GET array) so that I can save it to database.
Please help. Thanks in advance.

1

There are 1 best solutions below

1
On

you should try encoding and decoding the variable you are passing because escaping is not directly allowed in url.

Try this

   $caption=urlencode("mycaption' goes here");

and then pass $caption to your url