Welcome to WebmasterWorld Guest from 22.214.171.124 , register , free tools , login , search , subscribe , help , library , announcements , recent posts , open posts Subscribe to WebmasterWorld
Passing two variables as one? Apostrophe's causing me grief suzie250 msg:3321430 4:38 pm on Apr 25, 2007 (gmt 0) Basically, what I am trying to do is pass a variable, use mod_rewrite to rename the page and then use that pagename to pull info from the database accordingly.
I can do all that until I run across a name with an apostrophe. I've tried str_replace to remove the apostrophe so that it does not show up in the URL but then I cannot get it back to pull the rest of the data.
The simplest solution would be to use $id along with $pagename but I really would like the URL to show just the value of $pagename.
What are my options?
jatar_k msg:3321436 4:42 pm on Apr 25, 2007 (gmt 0)
what are you replacing the ' with?
you could replace it with another char, maybe a _ , and then change it back in the destination script
suzie250 msg:3321450 4:53 pm on Apr 25, 2007 (gmt 0)
Was replacing it with actually nothing, so the URL would show as Johns-Business. jatar_k msg:3321462 4:57 pm on Apr 25, 2007 (gmt 0)
maybe making it
would work, then you can str_replace the _ with ' when it hits the script
suzie250 msg:3321488 5:29 pm on Apr 25, 2007 (gmt 0)
hmmm, maybe, but I really don't like the way that looks. That does have me thinking maybe I can store it in the database differently.
Is there no way to pass two variables, say in an array, and still use mod_rewrite to get what I want?
jatar_k msg:3321496 5:32 pm on Apr 25, 2007 (gmt 0)
if you're putting them in the url you can do it like
then you would have to figure out the rewrite rule
you could rewrite it to something like
it's hard to pass 2 vars but not show one of them