Containers and there is a Variable "sresult" which is somehow undefined.But i don't understand why , i thought it's possible to pass a Variable to another Div-Container.
This is my fist Div-Container :
<div id = "header">
<h1>User-Search</h1>
<?php if(!empty($user)): ?>
<?php
echo'<form action="search.php" method="POST">
<input type="text" placeholder="User Search" name="search_user">
<input type="submit">
</form>';
if(!empty ($_POST['search_user'])):
$search_user = "SELECT username FROM users WHERE username like :search_user";
$edited_search_user = "%".$_POST['search_user']."%";
$suser = $conn->prepare($search_user);
$suser->bindParam(':search_user', $edited_search_user);
$suser->execute();
$sresult = $suser->fetchAll();
?>
<?php endif; ?>
<?php endif; ?>
</div>
And this is my Second one :
<div id = "textarea">
<?php
if(count($sresult)> 0)
{
foreach ($sresult as $srow)
{
echo'<table>';
echo'<th>Username : </th>';
echo'<td>'.$srow["username"].'</td';
echo'</table>';
}
}
else {
echo 'No User found !';
}
?>
</div>
i tried to put everything together in one Div-Container but even there it didn't worked.