Jump to content

Echoing Search Criteria


smonkcaptain

Recommended Posts

Hey All.

 

Say someone was searching my photo database website from a drop down menu.

 

They search for the aircraft: 'Boeing 747' and airline: 'British Airways', which is posted with the url 'result.php?aircraft=Boeing+747&airline=British+Airways'.

 

How would i get my php to echo:

 

Your search for 'Boeing 747 > British Airways' is displayed below:

 

Or if the search was for just: Aspect: Flightdeck, echo:

 

Your search for 'Flightdeck' is displayed below:

 

 

 

 

I hope it's clear,

 

Thanks, Jimmy :D

Link to comment
https://forums.phpfreaks.com/topic/232315-echoing-search-criteria/
Share on other sites

You haven't show the code you use to echo that so I have no idea.

 

Sorry, completly forgot:

 



<?php if(!empty($_GET)) {
   $criteria= htmlentities(implode(' > ', $_GET));
}?>



<p class="resulttext">Your search <strong><?php  echo $criteria;?></strong> returned <strong><?php echo $num;?></strong> photo results, these are displayed below.</p>




$criteria =implode('</strong> > <strong>', array_map('htmlentities', $_GET));

I would just insert the word "for" after "Your search" in the HTML.

 

Thanks for that mate that's done it!

 

I could put 'for' before using HTML, however if there is no search criteria is would make no sense;

 

ie. Your search for returned X photo results, these are displayed below.

 

Thanks!

$criteria =implode('</strong> > <strong>', array_map('htmlentities', $_GET));

I would just insert the word "for" after "Your search" in the HTML.

 

Thanks for that mate that's done it!

 

I could put 'for' before using HTML, however if there is no search criteria is would make no sense;

 

ie. Your search for returned X photo results, these are displayed below.

 

Thanks!

 

Sorted now, thanks anyway! :)

 

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.