close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

search string

Thread began 5/24/2019 3:25 am by Jamie | Last modified 5/24/2019 12:22 pm by Ray Borduin | 433 views | 4 replies |

Jamie

search string

Hey Ray

Am trying to get a search by postcode working. As am sure youre aware, UK postcode look like SW6 3AH - in the database, I have set it so that the space is removed and the code is just 1 long string.

What am not sure how to do is in the search form to remove the space when the visitor types in SW6 3AH as people can type in either SW6 3AH or SW63AH

Also, how would I make the search search exactly by SW6 3AH?

<?php
$searchMaps_1 = new WA_MySQLi_Search("Maps","");
if (isset($_POST["WADbSearch1"]) || isset($_POST["WADbSearch1_x"])) {
$searchMaps_1->clearSearch();
$searchMaps_1->setSearch(array("type"=>"Key", "comparison"=>"Includes", "join"=>"AND", "and"=>", ", "or"=>" ", "start_encap"=>"\"", "end_encap"=>"\""), array("GalleryTags"), "s", "".((isset($_POST["SearchContent"]))?$_POST["SearchContent"]:"") ."");
}
?>



<form action="maps.php" method="post" id="searchForm" name="searchForm" class="form-container searchForm">
<input value="" name="SearchContent" type="text" class="postcodeINput" placeholder="search by Post Code">
<button type="submit" class="searchButton" name="WADbSearch1" value="1">SEARCH</button>
<button type="button" class="searchButton" onclick="document.location.href='maps.php?reset=true'">CLEAR</button>
</form>



Cheers

Sign in to reply to this post

Ray BorduinWebAssist

php:
<?php

$searchMaps_1 
= new WA_MySQLi_Search("Maps","");
if (isset(
$_POST["WADbSearch1"]) || isset($_POST["WADbSearch1_x"])) {
  
$searchMaps_1->clearSearch();
  
$searchMaps_1->setSearch(array("type"=>"Key""comparison"=>"=""join"=>"AND""and"=>", ""or"=>" ""start_encap"=>"\"""end_encap"=>"\""), array("GalleryTags"), "s""".((isset($_POST["SearchContent"]))?str_replace(" ","",$_POST["SearchContent"]):"")  ."");
}
?>
Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

thanks Ray. I didnt realise it would make a difference but some of the maps have multiple postcodes associated with it separated by a comma

so we may have SW63AH,SW79PA,SW810OU - what would I need to do to accommodate that?

Sign in to reply to this post

Ray BorduinWebAssist

You probably have to use:

"comparison"=>"includes"

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

ok thanks

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

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.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...