I have searched the site for an answer to my question, however the solutions have been unable to solve my problem.
My Problem is: I have tried to add a php echo element inside of an html tag. However it is throwing off an error as seen in the screenshot. I have tried various ways to adjust this code unsuccessfully.
I should mention that it is a simple MVC application.
Thanks in advance for any advice.
You were concating wrong. Be careful with ' and ".
echo '<img src= " '. $page->image . ' " <br>';
The spaces between " are here just for readability.
And btw you can't execute PHP code inside html.
You can't separate your string like that:
echo 'Image' 'img src='...;
^
If you want to concatenate everything, use .
or just put it all on the same string:
echo 'Image <img src="'. $yourVariable.'"/>'; ...
Your ' and " were in the wrong spots. Also, not that it's related to your PHP erorr but you were also missing the < /> around your image.
echo 'Image: <img src="' . $page->image . '" alt=""/></br>';