Personal I have the following code:
<?php
$string = $_POST['search'];
foreach($results['results']['collection1'] as $collection) {
if(stristr($collection['prod']['text'],$string) !== false) {
echo "<div class='col-lg-4 col-sm-6'><img src='" . $collection['img']['src'] . "'><br />";
echo "<a target='_blank' href='" . $collection['prod']['href'] . "'>" . $collection['prod']['text'] . "</a><br />". $collection['valor'] . "</div>";
} else {
echo "Nada encontrado";
}
}
The problem that when the echo of the else goes into action the result is this: