Jump to content

[SOLVED] Store string without the italic symbols


phpfan

Recommended Posts

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... ???

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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.....  ???

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

... 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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.