Keep ASCII values from being "interpreted" by admin form?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Here, the problem -- I have a page synapticimpulse.com/houseplants.php that is created from a database. If you have the secret username and password, you can edit the plants, or add new ones.

When I add in a new plant, I put in "smart quotes" or ‘name’ for 'name'. These are done using ‘ and ’ -- but when I pull the information out of the db into a form for editing, they are just the symbols, not the ASCII values. Which means that they go back into the database as the symbols, not the values, and then my page won't validate because I'm using, that's right, the symbols instead of the values.

So!

I don't know where to look to find how to stop this from happening.

I've tried ignoring that it's ° in the database, and just done a string search to replace but that doesn't seem to work, so I'm thinking that it's not actually in the database as a symbol, but some other value that I can't search on...

Ideas?

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Lemme see if I get this...

You put &this; into the DB, and it goes in fine.
When pulling from the DB into a textfield, you get a degree symbol.
Then updating the DB, it's not back to &this;
Is that right?

Have you looked at the source code (php output) of the form?
I'm guessing that it is printing &this;, but in the textfield it shows a degree symbol. Try using a simple str_replace() to replace the & with &.

Mark Hensler
If there is no answer on Google, then there is no question.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

I tried that but got some bizarre errors in the display. Maybe I did it wrong.

Would I have to replace it on the way out as well as on the way back in? I didn't look at the source of the form, just the final result (drat!), thanks, I'll try that now and see if that makes the difference.

At least I was headed in the right direction this time, thanks, Mark!

Smiling S

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Got it, thanks, the page source for the FORM itself helped me track it down. Thanks!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.