Strict Standards: Creating default object from empty value in <--php_page_file_path--> on line <-- line_number-->
include('functions/simple_html_dom.php');
$content=str_get_html($submission);
$content->find('a', 0)->class='article-link';
$content->find('a', 0)->target='_blank';
$content->find('a', 0)->rel='nofollow';
$content->find('img', 0)->class='article-inner-image';
The variable $submission
will get the POST data from a form. It may or may not contain <a>
and <img>
tags. When both are present the warning is not thrown. But when one or both tags are not present, it throws this warning. How can I resolve this issue?
When the HTML is parsed, check if certain elements exist before altering them.