views:

135

answers:

1

I am trying to create a search page with MySQL fulltext.

I have a search page with a textbox: < FORM NAME ="form1" METHOD ="POST" ACTION ="catalog.php?action="> I pass the user's input to another webpage (catalog.php) which runs the query: "SELECT * FROM books WHERE MATCH (title) AGAINST (???)"

What do I place in the against() function? The argument needs to extract the user's input from the last page.

+2  A: 

According to the MySQL Manual you place the keywords in the against function.

$keywords = mysql_real_escape_string($_POST['name of the input box']);
mysql_query("SELECT * FROM books WHERE MATCH (title) AGAINST ('".$keywords."')");

Although i suggest using GET for search. No "Sure you want to post again" dialog on a page-refresh and you can modify the search criteria without the form.

Bob Fanger