homepage Welcome to WebmasterWorld Guest from 54.163.91.250
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
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?

Thanks,
Suzie

 

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

John_s-Business

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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved