The quotation marks surround a search phrase
Is there a way to build in quotation marks into a database search so that the user does not need to type quotation marks to surround a search phrase?
Is there a way to build in quotation marks into a database search so that the user does not need to type quotation marks to surround a search phrase?
you can force the quotes through php code, for example if the search form uses the GET method, and the search field is named "keyword":
<?php
if(isset($_GET['keyword']) && $_GET['keyword'] != "") {
$_GET['keyword'] = "\"".$_GET['keyword']."\"";
}
?>
Hi again Jason, if I use post, would this be correct?:
<?php
if(isset($_POST['Products']) && $_POST['Products'] != "") {
$_POST['Products'] = "\"".$_POST['Products']."\"";
}
?>
If it is correct, where exactly do I place this code? At the top of the results page?
Many thanks
Yes, that would be correct for the POST method. Place the code at line 1 of the results page.
Excellent thanks Jason. It works a treat!!
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.