How to get rid of undefined variable in previous post image
I am working on a website on WordPress and I have it set to where the bottom of the post will automatically link to a random previous post with a picture from that previous link but a notice keeps popping up on the bottom. It says there is something wrong with the previous post image url but the website sets this automatically and it works for all my other posts. Since it is undefined should I try to define it in the code and include the url and image url? There is an if statement beforehand that makes this code run if there is a previous post image url and this is using the Mia theme on WordPress
previous_post_link( '%link', 'div class=post-navigation-imageimg src=' . $previous_post_image_url . ' //divdiv class=post-navigation-contentdiv class=post-navigation-titlespan class=next-postNext Post gt;/spanh3%title/h3/div/div' );
echo '/div';