Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML tags inside PHP Variable

Status
Not open for further replies.

Diggum1

Programmer
Oct 14, 2004
67
US
I have the following variable that I'd like to add a superscript character to. If the value from a dropdown selection equals MLS(ASAP), I'd like to add that CM superscript to the value. This value will be inserted into an Excel CSV via FPDF.

However, the code below simply inserts the HTML tags, it doesn't render the superscript.

Can this be done?

if($cred=='MLS(ASCP)')
$cred='MLS(ASCP)<sup>CM</sup>';


Thanks,
Rick
 
That's the way to do it, and it actually works for me as is, if I display it in a browser.

However if you are creating a CSV file, then its treated as text. There's no reason for Excel to interpret the HTML. so no reason for the tags to work.






----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Yea, that makes sense, no reason for Excel to interpret html tags. I'll keep digging.
 
You could just pass it as HTML instead.


Don't know what you are creating, but if its say a a table of data, perhaps instead of creating the CSV file, just create a real HTML table, and save the file as HTML. then Excel will be inclined to interpret the HTML as is, so HTML tags like the superscript will also be interpreted.


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
This is what I'm doing.

I have a dropdown that have 5 selections. One of these selections should have a superscript in it's value. But I can't put a superscript inside a dropdown value, so I was trying to use PHP to convert that value into a superscript.

These values are then first previewed as a PDF via FPF (it's a business card), then once the user approves the PDF, submits the values to an Excel csv which is then attached to an email and sent to a printer. So, it has to be a csv.

Unfortunately, I can't get superscripts into the csv (or into the PDF for that matter - FPDF also displays the tags, not the rendered superscript character).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top