I have a function which compares emails contents from a few tables. If the contents differ, I want to display it for comparison. I am trying to do that using iframes and srcdoc attribute. This is a fragment of my email which has got inline styles and nested quotes.
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> <title>Title</title> </head> <style type="text/css">a:visited {color: #fff;}</style> <body style="background: #fff; margin-top:25px; margin-bottom:30px; padding-top:0; padding-bottom:0;"> <table align="center"> I tried to replace all quotes with that function.
str_replace([ '"', '&' ], [ '"', '&amp;' ],$row1['email_content']) but it does not work. I have also tried
htmlentities($row1['email_content']) and
addslashes($row1['email_content']) but it also did not work. How can i display email content in an iframe properly?
echo '<iframe srcdoc="'.$row1['email_content'].'"></iframe>';