phpfan Posted March 23, 2007 Share Posted March 23, 2007 Hi I recently experienced the following problem i would like your opinions or solutions about it.... I want to output a combined string to my website a string that consists of regular and italic letters. To do that i use the followung code $NAME = $NAME.'<i>'.$detailsName.'</i>' The string is created correctly and the output look like the this: Yamaha YZF R1 But when i try to store the variable $NAME in my database the value that is stored look like this: Yamaha<i>YZF R1</i> Is there any way that i can store the variable name without the italic symbols... ??? Quote Link to comment https://forums.phpfreaks.com/topic/44034-solved-store-string-without-the-italic-symbols/ Share on other sites More sharing options...
AndyB Posted March 23, 2007 Share Posted March 23, 2007 Is there any way that i can store the variable name without the italic symbols... ??? Assuming the question is how to store it so it outputs what you want ... $name = $name. " <em>". $detailsName. "</em>"; The i tag is deprecated, so use em instead. Quote Link to comment https://forums.phpfreaks.com/topic/44034-solved-store-string-without-the-italic-symbols/#findComment-213850 Share on other sites More sharing options...
artacus Posted March 23, 2007 Share Posted March 23, 2007 Try strip_tags() if you want to get rid of the markup. Quote Link to comment https://forums.phpfreaks.com/topic/44034-solved-store-string-without-the-italic-symbols/#findComment-213865 Share on other sites More sharing options...
phpfan Posted March 23, 2007 Author Share Posted March 23, 2007 I have try to use the em tags but still the same result... How i can use strip_tags() ? Quote Link to comment https://forums.phpfreaks.com/topic/44034-solved-store-string-without-the-italic-symbols/#findComment-213870 Share on other sites More sharing options...
AndyB Posted March 23, 2007 Share Posted March 23, 2007 I think we need a better description of the problem .. and possibly more than a single line of code if you're getting "the same problem" (which you don't really define). Notice I forced a space in the string using Did you? Quote Link to comment https://forums.phpfreaks.com/topic/44034-solved-store-string-without-the-italic-symbols/#findComment-213895 Share on other sites More sharing options...
phpfan Posted March 23, 2007 Author Share Posted March 23, 2007 Hi I have the following code $NAME = $NAME. " <em>". $detailsName. "</em>"; but the result in the field look like this Yoshimura Full Exaust System <em> (Colour: Carbon)</em> I have enter the result in the code tags because i wanted to show the em symbols Quote Link to comment https://forums.phpfreaks.com/topic/44034-solved-store-string-without-the-italic-symbols/#findComment-213910 Share on other sites More sharing options...
AndyB Posted March 23, 2007 Share Posted March 23, 2007 If you have that code and what's stored in the database is what you say, then the actual variables $Name and $detailsName must have a trailing space and a leading space respectively. It matters not how the data looks viewed in the database field, what matters surely is how it displays when echo'd out to the page. For example: <?php $NAME = "Yoshimura Full Exhaust System"; $detailsName = "(Colour: Carbon)"; $NAME = $NAME. " <em>". $detailsName. "</em>"; echo $NAME; ?>[code] [/code] Quote Link to comment https://forums.phpfreaks.com/topic/44034-solved-store-string-without-the-italic-symbols/#findComment-213941 Share on other sites More sharing options...
phpfan Posted March 24, 2007 Author Share Posted March 24, 2007 I still experience the same results... PHP seems to read them em symbols and produce italic characters when i echo the string, but when i try to save it in the database the string seems to combined as a whole an stored as a whole... Quote Link to comment https://forums.phpfreaks.com/topic/44034-solved-store-string-without-the-italic-symbols/#findComment-214064 Share on other sites More sharing options...
AndyB Posted March 24, 2007 Share Posted March 24, 2007 Wht does it matter to you how it looks in the database? Nobody sees that. Quote Link to comment https://forums.phpfreaks.com/topic/44034-solved-store-string-without-the-italic-symbols/#findComment-214196 Share on other sites More sharing options...
phpfan Posted March 25, 2007 Author Share Posted March 25, 2007 Because my system generates automatic email confirmations, i need to store the values without any symbols otherwise the symbols are presented to the confirmation email.. For example if a variable is stored in the database as Yoshimura Full Exhaust System <em> (Colour: Carbon)</em> then the email sent to the user will present the ordered item as Yoshimura Full Exhaust System <em> (Colour: Carbon)</em> They cannot recognize the em or any other symbols so they present them as characters..... ??? Quote Link to comment https://forums.phpfreaks.com/topic/44034-solved-store-string-without-the-italic-symbols/#findComment-214637 Share on other sites More sharing options...
MadTechie Posted March 25, 2007 Share Posted March 25, 2007 erm why not just strip them out before using them in the email ? !! <?php $NAME = strip_tags($NAME, '<br>') //if you wanna [b]keep[/b] the <br> ?> also if the text is showing up in italics on the database, i am guessing that your viewing it via your browser Quote Link to comment https://forums.phpfreaks.com/topic/44034-solved-store-string-without-the-italic-symbols/#findComment-214705 Share on other sites More sharing options...
AndyB Posted March 25, 2007 Share Posted March 25, 2007 ... then the email sent to the user will present the ordered item as ... Sounds as though you need to modify the part of the script that defines the MIME type of the email so that it's an html email. In whatever system you have, surely that's some simple configuration switch. Quote Link to comment https://forums.phpfreaks.com/topic/44034-solved-store-string-without-the-italic-symbols/#findComment-214718 Share on other sites More sharing options...
phpfan Posted March 26, 2007 Author Share Posted March 26, 2007 I am currently experienced some problems with my ftp connection and i cannot try what i have found, but if am correct i have to change my existing mail () function and at the email headers also add Content-Type:text/html Quote Link to comment https://forums.phpfreaks.com/topic/44034-solved-store-string-without-the-italic-symbols/#findComment-215112 Share on other sites More sharing options...
phpfan Posted March 28, 2007 Author Share Posted March 28, 2007 Hi all I have tried that and work perfect. Thanks AndyB you have been very helpful and also thanks to all that gave me there advice on this matter.... Quote Link to comment https://forums.phpfreaks.com/topic/44034-solved-store-string-without-the-italic-symbols/#findComment-216558 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.