phpretard Posted September 14, 2008 Share Posted September 14, 2008 I am pulling info from a DB and emailing it based on variable names. Randal's Appraisals, LLC <--EXAMPLE When it gets emailed the company name stops at the apostrophe. So the "From" Line in the Email reads "Randal". Any other company names works great. So I guess the question is how can I get the PHP variable to (for lack of better words) ignore and still print the apostrophe? I think the only real significant script is: $mail->FromName = "$CompanyName"; If you need more please let me know... Thanks. Quote Link to comment Share on other sites More sharing options...
phpretard Posted September 14, 2008 Author Share Posted September 14, 2008 Should I addslashes when I call it from the DB? It is in the DB just like this--> Randal's Appraisals, LLC Quote Link to comment Share on other sites More sharing options...
phpretard Posted September 14, 2008 Author Share Posted September 14, 2008 Should I add/strip slashes when putting text into the DB or pulling them out? I have read into this...just need a little help here. Quote Link to comment Share on other sites More sharing options...
Mchl Posted September 14, 2008 Share Posted September 14, 2008 You should run mysql_real_escape_string() on data before you insert it into database Quote Link to comment Share on other sites More sharing options...
phpretard Posted September 14, 2008 Author Share Posted September 14, 2008 OK. But when I try to use it in a "FROM" line in an email it stops where the apostrophe starts. any thoughts there? So instead of being FROM - Randal's Appraisals, LLC It is FROM - Randal Quote Link to comment Share on other sites More sharing options...
Mchl Posted September 14, 2008 Share Posted September 14, 2008 addslashes() Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted September 14, 2008 Share Posted September 14, 2008 How are you displaying the output? Addslashes() will not work if this is being displayed to the browser. When displaying data to the browser you should use htmlentities(). Ken Quote Link to comment Share on other sites More sharing options...
phpretard Posted September 14, 2008 Author Share Posted September 14, 2008 I am displaying it in the "From" Line in an email. $CompanyName="Randal's Appraisals, LLC"; $mail->FromName = "$CompanyName"; Quote Link to comment Share on other sites More sharing options...
phpretard Posted September 14, 2008 Author Share Posted September 14, 2008 This does not do what it says... $str = "A 'quote' is <b>bold</b>"; // Outputs: A 'quote' is <b>bold</b> echo htmlentities($str); echo "<br><br>"; // Outputs: A 'quote' is <b>bold</b> echo htmlentities($str, ENT_QUOTES); Quote Link to comment 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.