I have searched for a solution to this problem on daniweb and google to no avail. You folks have been so kind as to help me before.

This portfolio piece, slash website for my father incorporates a MySQL PHP search form in the left div, and the search results in the right div.

My intent is to have the .png file appear in the results div upon the first landing of the visitor. To be replaced by the visitors search results. Possibly with a link in case the visitor would like to see it again.

Could someone please point me in the right direction?

ardav?

Recommended Answers

All 3 Replies

Assuming <div id="results"> is the box on the right that first holds the image and then shows results after searching, you could do something like:

// Have code that processes the form, and stores results in an array, or have the form processed further down in the following "if" statement.

<div id="results">
<?php
   if($_POST["submit"]) { // replace "submit" with the name/id of the submit button in your search form
      echo $search_results;
   } else {
      echo '<img src="path/to/image.png" alt="Alternate Text" />';
   }
?>
</div> <!-- /results -->

Hope that helps.

- EF

Thanks EF!! Other than a few code tweeks worked first time!

Thanks EF!! Other than a few code tweeks worked first time!

Np, glad to help =)

commented: No Muss No Fuss! He really new his stuff! Thanks for your help. Motorider +1
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.