Hello guys,
Im having this one problem of removing + sign from url, not the plus sign that generated by browser to separate each word. But plus sign from the content itself.
situation
on page 1, user choose medicine from drop down menu named --> HYDRO+NEOMYCIN (1/8 oz), which have plus sign inside it...
then the page execute to the next page like this... nextpage.php?q=$data
i called back the data by using GET function
$q = $_GET['q'];
but when i wanted to query it from mysql, it return no result...
surprisingly if i paste the name of the medicine directly during query...it does return result..
like this.... $search = mysql_query("SELECT * FROM medicine WHERE name LIKE 'HYDRO+NEOMYCIN (1/8 oz)'");
sadly it doesnt work if i query it by string like this
$search = mysql_query("SELECT * FROM medicine WHERE name LIKE '%$q%'");
I guess it must be sumthing wrong during the transfer via URL...
i try remove the + sign using urldecode, ereg_replace, str_replace...but all doesnt work
do anyone know how to?
thanks
Azhan
removing plus sign ( + ) from url
Moderator: General Moderators
-
DaiLaughing
- Forum Commoner
- Posts: 76
- Joined: Thu Jul 16, 2009 8:03 am
Re: removing plus sign ( + ) from url
I'm guessing it's because even using an & code introduces a character which GET already uses.
urlencode() seems to be a possible answer. I've not used it but have a look.
urlencode() seems to be a possible answer. I've not used it but have a look.