Search Function
Posted: Tue Nov 21, 2006 1:01 am
feyd | Please use
Is that how you displace search results? Im not too sure.....
This my .html
sorry im really new...
As you can see, i need to do for drop down list and checkboxes too
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hi
Im working on a search function. Im totally new to programming Its really basic, just searching based on keywords so i learnt about partial match....
This is what i have done so far.....Code: Select all
<?php
session start();
//---THIS IS FOR "KEYWORDS" FIELD---
$keywords=($_POST['keywords']);
//check if field is blank
if (empty($keywords)){
echo 'this field cannot be blank';
// use partial match
$search=%+$keywords+%;
//link to database
$link=mysql_connect('localhost','root','') or die ("Error connecting to database.");
mysql_select_db('savory') or die ("Error connecting to database.");
$result=mysql_query("select * from webpage where keywords='$search'",$link);
mysql_close($link);
//displace search results
$numrows=mysql_numrows($result);
for(i=0;i<$numrows;i++)
}Is that how you displace search results? Im not too sure.....
This my .html
Code: Select all
<html>
<head>
<title>Search</title>
</head>
<body>
<table>
<form method="POST" action="search.php">
<tr>
<td>Keywords: <input type="text" name="keywords" size="20"></td>
<td>
<select name="category">
<option value= "news"> News
<option value= "shopping"> Shopping
<option value= "education"> Education
</td>
</tr>
<tr>
<td height="60"><b>Please tick only one</b></td>
</tr>
<tr>
<td>URL<INPUT type="checkbox" name="url"></td>
<td>Note<INPUT type="checkbox" name="note"></td>
<td>Title<INPUT type="checkbox" name="title"></td>
</tr>
<tr>
<td height="60"><input type="submit" value="Search" name="search"></td>
</tr>
</form>
</table>
</body>
</html>As you can see, i need to do for drop down list and checkboxes too
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]