I'm creating a car dealership website and I want to display a banner on each result page, but the banner should relate to the search the user made.

If the user searches for an Audi A4 the url is:
http://......../searchlisting.php?search=1&makems=38&models=25&price=-1&seller=&year=&x=35&y=8
If the user searches for an Audi A6 the url is:
http://......../searchlisting.php?search=1&makems=38&models=26&print=-1&seller=&year=&x=35&y=8

Regardless of the model searched, makems will always be =38 from Audi.
I'd like an Audi banner displayed on all the Audi results, a BMW banner on all the BMW results, etc.

So, is there any way to get makems=38 from the url and use it to display the appropriate banner?

I don't want to start creating database tables etc.

Thanks.

Recommended Answers

All 2 Replies

Well, without a database you will have to hardcode every condition as an if statement, but if that is really what you want to do then...

$makems = $_GET['makems'];
if ($makems==83){
  // place the audi banner
}

How about naming your banner images accordingly:
searchbanner38.jpg, searchbanner43.jpg, etc. and in your search result choose the source of the banner image like this:

echo "<img src='path/to/images/searchbanner" . $_GET['makems'] . ".jpg'/>";

definitely a few ways to skin this cat...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.