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
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>




Link to comment
Share on other sites

$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!

Link to comment
Share on other sites

$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! :)

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.