double quote problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Da_Elf
Forum Commoner
Posts: 81
Joined: Mon Dec 29, 2008 12:31 pm

double quote problem

Post by Da_Elf »

I'm populating a popup menu with some options stored in a mysql database. for the option im using this

<option value="<?=stripslashes($newaa['GalProse'])?>"><?=stripslashes($newaa["GalProseName"])?></option>

with this though if there is a double quote it wont show up. On the reverse.......

<option value='<?=stripslashes($newaa["GalProse"])?>'><?=stripslashes($newaa["GalProseName"])?></option>

.....i wont get single quotes
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Re: double quote problem

Post by Burrito »

huh?

stripslashes() will remove any slashes thereby removing the escape from your quotes. What is your problem exactly? Your first post is very vague.
Da_Elf
Forum Commoner
Posts: 81
Joined: Mon Dec 29, 2008 12:31 pm

Re: double quote problem

Post by Da_Elf »

if ive got an entry in my mysql database under GalProse
entry = We'll say "hello"

in the first option the value would loose everything after the first "
in the second option the value would loose everything after We due to the opening of quotes in the value. if i dont use quotes then the value will only be the first word
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Re: double quote problem

Post by Burrito »

so then pick a quoting type, stripslashes() and replace the chosen quote type with \%quotetype%
Da_Elf
Forum Commoner
Posts: 81
Joined: Mon Dec 29, 2008 12:31 pm

Re: double quote problem

Post by Da_Elf »

i dont get what you mean by /%quote type%
Da_Elf
Forum Commoner
Posts: 81
Joined: Mon Dec 29, 2008 12:31 pm

Re: double quote problem

Post by Da_Elf »

i still cant find anything on google for that
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Re: double quote problem

Post by Burrito »

%quotetype% is just whichever quote type you choose to use (double or single) for your <select> boxes.
Da_Elf
Forum Commoner
Posts: 81
Joined: Mon Dec 29, 2008 12:31 pm

Re: double quote problem

Post by Da_Elf »

im not the one who will be inputting data into the mysql database. so ill have to leave a disclaimer letting people know to use single quotes only rather than double quotes.
Post Reply