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. Link to comment https://forums.phpfreaks.com/topic/124159-apostrophes/ 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 Link to comment https://forums.phpfreaks.com/topic/124159-apostrophes/#findComment-641019 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. Link to comment https://forums.phpfreaks.com/topic/124159-apostrophes/#findComment-641024 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 Link to comment https://forums.phpfreaks.com/topic/124159-apostrophes/#findComment-641031 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 Link to comment https://forums.phpfreaks.com/topic/124159-apostrophes/#findComment-641040 Share on other sites More sharing options...
Mchl Posted September 14, 2008 Share Posted September 14, 2008 addslashes() Link to comment https://forums.phpfreaks.com/topic/124159-apostrophes/#findComment-641068 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 Link to comment https://forums.phpfreaks.com/topic/124159-apostrophes/#findComment-641079 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"; Link to comment https://forums.phpfreaks.com/topic/124159-apostrophes/#findComment-641082 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); Link to comment https://forums.phpfreaks.com/topic/124159-apostrophes/#findComment-641100 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.