Stripping tags from PHP variable for PDF generation

Hi, I’m using a PDF generator (FPDF) to output a field from a mySQL db, which is represented by a PHP variable. This also appears on the page from which the PDF is generated, and works fine as the HTML tags which are inside the data are interpreted properly by the browser.

Obviously the variable gets interpreted literally by the PDF generator so what’s happening is that <p> and </p> and other markup (and also backslahes to escape apostrophes) is appearing in the PDF.

I was thinking of creating a new variable based on the original one but with the tags stripped out wherever they might appear, but not sure how this can be done. Any ideas? Basically strip out backslashes and also <, >, / and anything in between the < and > text wherever it appears…

Thanks, that seems to work well- hadn’t seen that before.

Only extra thing I had to do was pass the result through stripslashes. Once that was done, all good.

Thanks again

Are you looking for strip_tags?