<?include "conninfo.php";
include "top.php";
$sr=$_POST["sr"];
$fl=$_POST["fl"];
//print_r($_POST);

$query="SELECT * FROM people WHERE ";

if($fl=="f")
{
$query.="firstname like '$sr'";
}
else if($fl=="s")
{
$query.="surname like '$sr'";	
}
else{
$query.="starsign like '$sr'";
}

$result=mysqli_query($link,$query);
$numrows=mysqli_num_rows($result);

if($numrows>0)
{

while($r=mysqli_fetch_array($result))
	{
	echo $r["id"]." ";
	echo $r["firstname"]." ";
	echo $r["surname"]." ";
	echo $r["starsign"]." ";
	
	if($r["url"]!="")
	{	
	?>
	<a href="<?echo $r["url"]." ";?>">Link</a>
	<?}
		
	if($r["picture"]!="")//if equal to something
	{?>
	<img src="images/<?echo $r["picture"];?>" width="50">
	<?}
	echo "<br>";
	
	}
}
else
{
	echo "Nothing found";
}


include "bottom.php";
?>