您可以尝试以下方法:
搜索.html
<html>
<head>
<title>Search the Database</title>
</head>
<body>
<form action="/test/search.php" method="post">
Search: <input type="text" name="term" /><br />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>
搜索.php
<?php
mysql_connect ("localhost", "username","password") or die (mysql_error());
mysql_select_db ("database");
$term = $_POST['term'];
$sql = mysql_query("select * from database where XXXXXX like '%$term%'");
while ($row = mysql_fetch_array($sql)){
echo 'ID: '.$row['XXXXX'];
echo '<br/> First Name: '.$row['XXXX'];
echo '<br/> Last Name: '.$row['XXXX'];
echo '<br/> Phone: '.$row['XXXX'];
echo '<br/><br/>';
}
?>