Here is one i made 2 years ago...in your case it will be perfect
<?phpinclude("header.php");echo '<h1>S?kning</h1> <div class="descr">S?k efter</div>';echo '<form action="search.php" method="get">';echo 'Sortera efter:<br><select name="orderby">';echo '<option value="username">User</option>';echo '<option value="Fname">F?rnamn</option>';echo '<option value="Lname">Efternamn</option>';echo '<option value="email">Email</option>';echo '</select>';echo '<br><br><br>';echo '<table>';echo '<tr><td><b>S?K:</b></td></tr>';echo '<tr><td><select name="select">';echo '<option value="username">Username: </option>';echo '<option value="Fname">F?rnamn: </option>';echo '<option value="Lname">Efternamn: </option>';echo '<option value="email">Email: </option>';echo '</select>';echo '<input type="text" name="username" /></td></tr>';echo '<tr><td><input type="submit" name="submit" value="Search" /></td></tr>';echo '</table>';echo '</form>';$result2=$_GET['username'];$orderby=$_GET['orderby'];$result3=$_GET['select'];$theres=trim($result2);if ($theres== "") { echo "<br><br><p>Fyll i f?re du s?ker !</p>"; }if($_GET['submit']=='Search'){echo'Results for <b>'.$theres.'</b>... ';$result80=mysql_query("SELECT COUNT(*) FROM all_users WHERE $result3 LIKE '%$theres%'");echo 'Found <b>'.mysql_result($result80, 0).'</b> match/s<br><br>'; $result = mysql_query("SELECT * FROM all_users WHERE $result3 LIKE '%$theres%' ORDER BY '$orderby'"); $count = 0;echo '<table align=center>';while($row=mysql_fetch_array($result)){if($count == 0 || $count == 4 || $count == 8 || $count == 12){ echo "<tr>";} $count++;echo '<td><a href="gallery.php?user='.$row['username'].'"><img src="allimages/'.$row['start_picture'].'" width="120px" height="95px" class="img" alt="'.$row['username'].','.$row['description'].'"></a><br><center>'.$row['username'].'</center></td>';}if($count == 28 || $count == 32 || $count == 36 || $count == 40 || $count == 44 || $count == 48){ echo "<tr>";}}echo "</table>";?><?phpinclude("footer.php");echo'</div>';?>
Notice from rvalkass:
Fixed code tags.