$index = "user_name"; } else { if ($_POST["select_search"] == "email") { $index = "email"; } else { if ($_POST["select_search"] == "phone") { $index = "phone"; } else { if ($_POST["select_search"] == "address") { $index = "address"; } } } } } $result = get_users_for_search($val, $index); $count = 0; echo "<table>"; while ($row = mysqli_fetch_assoc($result)) { echo "<tr><td>"; echo $row["name"]; echo "</td>"; if (isset($row["profile_pic"])) { $pic = $row["profile_pic"]; echo '<td><img src="' . PATH . $pic . '" height=60 /></td>'; } else { echo '<td><img src="images/default_pic.jpeg" height=60 /></td>'; } echo "<td><a class=\"user_link\" href=\"user_profile.php?user_name={$row["user_name"]}\" target=\"blank\">View Profile</a>"; echo "</td></tr>"; $count++;
<form method="post" id="search" action="search.php"> <span> <input type="text" placeholder="Search..." name="search_for" id="search_for" /> <input name="searchsubmit" type="image" src="images/search.gif" value="Go" id="searchsubmit" class="btn" /> </span> </form> <!--/searchform --> <div class="clr"></div> <br><br> <?php if (isset($_POST["search_for"]) && !empty($_POST["search_for"])) { $index = ""; $val = $_POST["search_for"]; $result = get_users_for_search($val); $count = 0; echo "<table>"; while ($row = mysqli_fetch_assoc($result)) { echo "<tr><td>"; echo $row["name"]; echo "</td>"; if (isset($row["profile_pic"])) { $pic = $row["profile_pic"]; echo '<td><img src="' . PATH . $pic . '" height=60 /></td>'; } else { echo '<td><img src="images/default_pic.jpeg" height=60 /></td>'; } echo "<td><a class=\"user_link\" href=\"user_profile.php?user_name={$row["user_name"]}\" target=\"blank\">View Profile</a>"; echo "</td></tr>"; $count++;