PHP search form to manipulate for loop?

Discussion in 'General Programming Chat' started by jasgrey, Sep 2, 2014.

  1. jasgrey

    jasgrey Junior Member

    May 27, 2014
    Likes Received:
    I'm very novice in PHP. But I know what I need to do with my site that I'm building, I just can't do it myself. I don't even know if it's possible, so I was hoping someone could drop me some advice.

    I have a page that I'm building that is like a gallery of pictures. These pictures have hover effects, etc. Clicking them initiates a JavaScropt pop-up focus page thing. But, what I really need to do with this page is have a search bar at the top, and depending on the selections in the search form, it would initiate a PHP for loop that would only show results based on the criteria.

    How can you use a search form to manipulate the output of a for loop? This is the question.
  2. MrBlue

    MrBlue Senior Member

    Dec 18, 2009
    Likes Received:
    Web/Bot Developer
    Assuming your gallery entries are stored in a database, pass the search terms via an AJAX request to a PHP script which will generate the filtered results and display them.