Code: Select all
<html>
<head>
<title>Search the Database</title>
</head>
<body>
<form action="search.php" method="post">
Search: <input type="text" name="term" /><br />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>
Code: Select all
<?php
mysql_connect ("localhost", "root","password") or die (mysql_error());
mysql_select_db ("heskdb");
$term = $_POST['term'];
$sql = mysql_query("select * from hesk_std_replies where title like '%$term%'");
while ($row = mysql_fetch_array($sql)){
echo '<br/> id: '.$row['id'];
echo '<br/> message: '.$row['message'];
echo '<br/><br/>';
}
?>id: '.$row['id']; echo '
message: '.$row['message']; echo '
'; } ?>
I have created HTML/php page all as one as follows
Code: Select all
<html>
<head>
<title>Search the Database</title>
</head>
<body>
<form action="search2.php" method="post">
Search: <input type="text" name="term" /><br />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>
<?php
mysql_connect ("localhost", "root","password") or die (mysql_error());
mysql_select_db ("heskdb");
$term = $_POST['term'];
$sql = mysql_query("select * from hesk_std_replies where title like '%$term%'");
while ($row = mysql_fetch_array($sql)){
echo '<br/> id: '.$row['id'];
echo '<br/> message: '.$row['message'];
echo '<br/><br/>';
}
?>