Jump to content

Spaces in a search box


bk1984

Recommended Posts

Hi all,

 

I am currently trying to fix the search on a website I am trying to develop. What happens is if you search for 'bin' a lot of products come up which contain bin within their product description, this is very annoying as you can imagine because things like post it notes will appear which are totally unrelated.

 

But when I add spaces into the the search for example (space)bin(space) it will come up with the correct products. I am baffled I have search through the code numerous times and just don't know how to do it. I am a beginner at PHP but hoping to quickly learn so I can get the website running functionally how everyone wants it.

 

the code is:

<?php

 

$app = $this->globals('khxc_display.app');

$eol = $this->globals('khxc.eol');

$formid = $app . '--minisearch';

$strid = $app . '--prodsearch--string';

$link = $this->link_namespace($app,'prodsearch',array());

$typeid = $app . '--prodsearch--type';

$cgi_value = '';

 

$this->xhtml_quickform_header($formid,$app,'prodsearchp',array());

 

print '<p class="hidden"><label for="' . $app . '--minisearch--' . $strid . '"';

print '>Search Term</label></p>' . $eol;

 

print '<p class="inline"><input class="khxc_quickfield" type="text" name="' . $strid;

print '" id="' . $app . '--minisearch--' . $strid . '" value="';

print $cgi_value . '" size="22" maxlength="100" /></p>' . $eol;

 

print '<p class="hidden"><input class="khxc_quickfield" type="text" value="EXACT" name=" ' . $typeid;

print '" id="' . $app . '--minisearch--' . $typeid . '" value="ALL" /></p>' . $eol;

 

$this->xhtml_quickform_footer($formid,'Online Store Search',1);

 

print '<a class="unfancy" href="' . $link . '" title="Advanced Search">Advanced Search</a>' . $eol;

?>

 

any help would be extremely appreciated

 

Thank you in advance

Ben

Link to comment
https://forums.phpfreaks.com/topic/161494-spaces-in-a-search-box/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.