Welcome to WebmasterWorld Guest from 107.20.122.81

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Passing two variables as one?

Apostrophe's causing me grief

     

suzie250

4:38 pm on Apr 25, 2007 (gmt 0)

10+ Year Member



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?

Thanks,
Suzie

jatar_k

4:42 pm on Apr 25, 2007 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

4:53 pm on Apr 25, 2007 (gmt 0)

10+ Year Member



Was replacing it with actually nothing, so the URL would show as Johns-Business.

jatar_k

4:57 pm on Apr 25, 2007 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



maybe making it

John_s-Business

would work, then you can str_replace the _ with ' when it hits the script

suzie250

5:29 pm on Apr 25, 2007 (gmt 0)

10+ Year Member



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

5:32 pm on Apr 25, 2007 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



if you're putting them in the url you can do it like

example.com?id=654&pagename=something

then you would have to figure out the rewrite rule

you could rewrite it to something like

example.com/654/something

it's hard to pass 2 vars but not show one of them

 

Featured Threads

Hot Threads This Week

Hot Threads This Month