Skip to content
Advertisement

symbol can’t be printed in GET php

I have a link like this:

http://domain.com/page.php?product=brown+rice

And then in the page.php page I GET the product:

JavaScript

But it only prints : brown rice without the +

How to get the + in the get method?

Advertisement

Answer

First, I will replace it with any different symbol before I pass it in the link:

For example:

JavaScript

And then in the page.php I will turn it back to the original symbol:

JavaScript

This method will only replace all products which have + symbol in the url. And when you GET it, it will check if the name of the product will have the symbol.

I hope that you understand and it helps

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement