0

In my website, I am passing the user input to a new page using get method. And I am having troubles when the user enters something with &. I am reading two inputs from user. Assume the user entered xxxyyzz for $_GET['input1'] and aaa&bbb for $_GET['input2']. Here is the page the user is directed to:

http://www.mywebsite.com/?input1=xxxyyzz&input2=aaa&bbb

In the directed page, I am getting the inputs using this code:

$input1 = $_GET['input1'];
$input2 = $_GET['input2'];

Obviously $input2 is not populated properly when the user enters an input with something &.

Is there any simple way to handle this other than replacing all &s with another string?

Will
  • 24,082
  • 14
  • 97
  • 108
Baykal
  • 569
  • 2
  • 10
  • 15

0 Answers0