I have what most likely is a very simple question for you experienced PHP
developers out there, I am trying to add some PHP
code to a PDF
generation software that I am currently using.
The issue that I am having I believe lies in my quotes. I have tried single quotes, double quotes with a single quote on the outside, escaping the php
, just about everything that I could think of, still no luck.
My code currently looks like this:
<?php
// add code to check if data
if (!empty($form_data['field'][39]))
{
echo "<div style="text-align:center;">
<?php foreach($form_data['field'][274] as $url):?> <img src="<?php echo str_replace(site_url(), ABSPATH, $url); ?>" width="250px" /> <?php endforeach; ? >
</div>";
?>
What I am trying to accomplish is this, when there is data entered into 'field' 39, it should echo the generated image below. This image though is generated dynamically, so I need to replace the URL as such so I have the str replace for the site url, but I am unsure of which quotes to change throughout this echo, all my attempts have just broken the PDF that is generated.