1

I have this URL in my page

https://www.albaama.com/search.php?qry=Fashion%20&%20Clothing

and I use this code below to echo out the value of the variable 'qry'

<?php 
    if (isset($_GET['qry'])) {
        echo $_GET['qry'];
    } 
    else {
        echo "";
    } 
?>

but whenever I echo it, I only get Fashion instead of Fashion & Clothing. please how do I get the complete value?

brightcode
  • 39
  • 4

1 Answers1

2

This query string: https://www.albaama.com/search.php?qry=Fashion%20&%20Clothing

Translates to this:

The problem is that & introduces a second parameter.

You need to urlencode() the entire string "Fashion & Clothing"

paulsm4
  • 114,292
  • 17
  • 138
  • 190