I've updated my PHP version to 7.4 and this error started showing afterwards. The error shows in the options, in <selected tag, when I try to maintain data even after the page has been refreshed.
<?PHP
$posts = filter_input_array(INPUT_POST, FILTER_DEFAULT);
?>
<form method="post" name="create_posts">
<label>Categories available</label>
<select name="category_id" class="select_list">
<option value="null">Pick a category: </option>
<?PHP
$readCategs= new Read();
$readCategs->query("SELECT DISTINCT ca.id AS cat_id,
ca.title AS title, ca.content AS content
FROM categories ca LEFT JOIN posts p ON p.cat_id = ca.id
ORDER BY title ASC");
//var_dump($readCategs);
if(!$readCategs->getResult()):
echo "<a href='create_category'><option disabled='disabled'>
There are no categories</option></a>";
else:
foreach($readCategs->getResult() AS $categs):
echo "<option value=\"{$categs['cat_id']}\" class='options' ";
if($posts['category_id'] == $categs['cat_id']):
echo 'selected="selected" ';
endif;
echo ">{$categs['title']}</option>";
endforeach;
endif;
?>
</select>
</form>````
The error shows on the "if($posts['category_id'] == $categs['cat_id']):" line