On the members page of my website, I need to have an option so that the members can look up the info of the other members. So far what I have done is create a search form...
<form id="searchform" name="searchform" action="searchresults.php" method="post">
Search Membership
<input type="text" name="search" id="textfield" placeholder="Search Members" />
<input type="submit" name="button" id="button" value="Search" />
</form>
I've also created a table in my database with all of the members info. Now I just need help with getting the form to communicate with the database table and take what is inputted into the search form and display the results on my results page.
I am not familiar with this and any help would be appreciated. Thanks.
UPDATE: So now I have the following PHP code on my searchresults.php page...
<?php
error_reporting(-1);
$host="";
$username="";
$password="";
$db_name="";
$tbl_name="MOAMemberSearch";
mysql_connect($host, $username, $password) or die("cannot connect");
mysql_select_db($db_name) or die("cannot select DB");
$sql = "SELECT * FROM MOAMemberSearch";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
if (false === $result) {
echo mysql_error();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Member Search - MOA</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/jquery.ennui.contentslider.css" rel="stylesheet" type="text/css" media="screen,projection" />
<style type="text/css">
#content_wrapper #content table {
color: #000;
}
</style>
</head>
<body>
<div id="menu_wrapper">
<div id="menu">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="boardofdirectors.html">Board</a></li>
<li><a href="members.php" class="current">Members</a></li>
<li><a href="ratingcard.html">Rating Card</a></li>
<li><a href="join.html">Join MOA</a></li>
<li><a href="contact.html">Contact Us</a></li>
</ul>
</div> <!-- end of menu -->
</div> <!-- end of menu wrapper -->
<div id="header_wrapper">
<div id="header"><!-- end of slider -->
</div>
<!-- header -->
</div>
<!-- end header wrapper -->
<div id="content_wrapper">
<div id="content">
<h1>Search Results</h1>
<table width="930" border="0" style="font-size:12px">
<tr>
<th>Sports</th>
<th>Last Name</th>
<th>First Name</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Zip</th>
<th>Phone 1</th>
<th>Phone 2</th>
<th>Email</th>
</tr>
<tr>
<td><?php echo $rows['Sports']; ?></td>
<td><?php echo $rows['LastName']; ?></td>
<td><?php echo $rows['FirstName']; ?></td>
<td><?php echo $rows['Address']; ?></td>
<td><?php echo $rows['City']; ?></td>
<td><?php echo $rows['State']; ?></td>
<td><?php echo $rows['Zip']; ?></td>
<td><?php echo $rows['Phone1']; ?></td>
<td><?php echo $rows['Phone2']; ?></td>
<td><?php echo $rows['Email']; ?></td>
</tr>
</table>
Currently getting an error where the search results should be appearing