View Full Version : special character like " ' !

04-15-2003, 11:17 AM
hello there,

How do I handle special characters like " ' !

how to I insert and retrieve and quote this in my forum? or form field?

thanks for any comment

04-15-2003, 11:42 AM
I really dont understand what you mean.

Do you want to put quotes in or do you want to remove the backslash \ that gets put in front of some quotes?

Could you give a bit more info please?

04-15-2003, 11:45 AM
I just read it again, And I think I may know:

If you want to put quotes into a string, do this...

$string = "Hello I'm Matthew"; // Single quotes ok, because they are within double quotes.

$string = "Hello, I'm \"Matthew\""; // Double quotes need to have a \\ before them in strings with double quotes.

$string = 'Hello, I\\\'m Matthew'; // Single quotes need to be backslashed because they are within single quotes.

$string = 'Hello I\\\'m "Matthew"'; // Double quotes ok, beacuse they are within single quotes.

Does this help?

I just noticed that VB Strips slashes ( like the stripslashes given below ) when they are behind certain chars. Some of single quotes should have backslashes behind them.

04-16-2003, 07:26 PM
What if he wants to remove those annoying back slashes in front of each quote when printing a string?

04-16-2003, 09:46 PM

That will remove the "magic quotes" that php puts into strings. I believe you can also turn magic quotes off completley, though I feel better with myself just using stripslashes, I mean, I don't like messing with the config too much :).

This site has more info: http://www.php.net/manual/en/function.stripslashes.php

04-16-2003, 10:24 PM
I was thinking stripslashes, but It didnt sound like he wanted that?

I should have put it any way. :rolleyes:

04-17-2003, 01:23 AM
Don't worry 'bout it missing-score. I think he/she did want the info you gave, I was just answering ConfusedOfLife's question.

04-17-2003, 08:23 PM
Thank you! :o

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum