Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8565659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:28:39+00:00 2026-06-11T17:28:39+00:00

I have a search engine which displays results from a database and have used

  • 0

I have a search engine which displays results from a database and have used a reveal modal which opens a pop up box when a user clicks “Click Me For More Contact Info”, however currently no matter which link is being clicked on any result, the same contact information is being echo’ed, this is the information from the first result.

could some one point me in the right direction showing me how to make it so that when a user clicks “Click Me For More Contact Info” the right contact information appears in the popup box for that result?

Thank you for any help, much appreciated!!

echo "<div id='myModal' class='reveal-modal'>";
echo "<h1>Modal Title</h1>";
echo "<p>Contact:" . $row['contact'] . "</p>";
echo "<a class='close-reveal-modal'>&#215;</a>";
echo "</div>";

echo "<a href='#' data-reveal-id='myModal'>Click Me For More Contact Info</a>";

edit: the search results display fine, its just when the results are echo’ed into the pop up div, this is the rest of my code:

include('config.inc');



    // Check and set username
$username = (isset($_SESSION['username']) ? $_SESSION['username'] : 'guest');

// Check and set category
$category = (!empty($_GET['category']) ? $_GET['category'] : null);

// Check and set search
if(!empty($_GET['search'])){
$search = $_GET['search'];
}else{
$search = null;
}

// Check that $_GET['price'] is ASC if not set to DESC
// as static values its ok to directly put in the query 
if(isset($_GET['price']) && $_GET['price'] == 'ASC'){
$price = 'ASC';
}else{
$price = 'DESC';
}

if ($search !== null){

$sql = "SELECT * FROM people WHERE MATCH (lname,fname) AGAINST (:search IN BOOLEAN MODE)";

$q   = $conn->prepare($sql) or die("failed!");
// Bind the params to the placeholders
$q->bindParam(':search', $search, PDO::PARAM_STR);
$q->execute();
}

if ($search !== null && $category !== null){

$sql = "SELECT * FROM people WHERE MATCH (lname,fname) AGAINST (:search IN BOOLEAN MODE) AND category = :category";

$q   = $conn->prepare($sql) or die("failed!");
// Bind the params to the placeholders
$q->bindParam(':search', $search, PDO::PARAM_STR);
$q->bindParam(':category', $category, PDO::PARAM_STR);
$q->execute();
}

if ($category !== null && $search !== null && isset($price)){

$sql = "SELECT   *
        FROM     people
        WHERE    MATCH (lname,fname) AGAINST (:search IN BOOLEAN MODE)
        AND      category = :category
        ORDER BY price ".$price;

$q = $conn->prepare($sql);
// Bind the params to the placeholders
$q->bindParam(':search', $search, PDO::PARAM_STR);
$q->bindParam(':category', $category, PDO::PARAM_STR);
$q->execute();
}

if ($category == null && $search !== null && isset($price)){

$sql = "SELECT   *
        FROM     people
        WHERE    MATCH (lname,fname) AGAINST (:search IN BOOLEAN MODE)

        ORDER BY price ".$price;

$q = $conn->prepare($sql);
// Bind the params to the placeholders
$q->bindParam(':search', $search, PDO::PARAM_STR);
$q->execute();
}

if ($q){

//declaring counter
    $count=0;
    while($r = $q->fetch(PDO::FETCH_ASSOC)){
    $row = $r;

    $fname = $row['fname'];
    $lname = $row['lname'];
    $firstname = $row['firstname'];
    $surname = $row['surname'];

//counter equals
$count++;

//insert an image every 5 rows
    if($count==5){
    $count=0;
   echo "<table width='50%' style='border-bottom:1px solid #000000;'";
echo "<tr>";
echo "<td>";
echo "<div id='page-wrap'>";
echo "<div class='discounted-item freeshipping'>";

echo "<a href='images/box1.png' rel='lightbox'><img src='images/box1.png' width='20%' height='98%' /></a>";


echo "<div class='reasonbar'><div class='prod-title' style='width: 70%;'>AN AD CAN GO HERE</div><div class='reason' style='width: 29%;'><b>Ad Company</b></div></div>";

echo "<div class='reasonbar'><div class='prod-title1' style='width: 70%;'>Description about the advert from a company</div><div class='reason1' style='width: 29%;'>Category: Advert</div></div>";

echo "<div class='reasonbar'><div class='prod-title2' style='width: 70%;'>HELLO, User</div><div class='reason2' style='width: 29%;'></div></div>";


echo "</td>";
echo "</tr>";
echo "</td>";
echo "</tr>";
echo "</table>";
}




echo "<table width='50%' style='border-bottom:1px solid #000000;'";
echo "<tr>";
echo "<td>";
echo "<div id='page-wrap'>";
echo "<div class='discounted-item freeshipping'>";

echo "<a href='./img/users/" . $row['category'] . "/" . $row['username'] . "/" . $row['filename'] . "' rel='lightbox'><img src=\"./img/users/" . $row['category'] . "/" . $row['username'] . "/" . $row['filename'] . "\" alt=\"\" width='15%' height='80%' /></a>";


echo "<div class='reasonbar'><div class='prod-title' style='width: 70%;'>" .$row['fname'] . "</div><div class='reason' style='width: 29%;'><b>". $row['firstname'] . " " . $row['surname'] ."</b></div></div>";

echo "<div class='reasonbar'><div class='prod-title1' style='width: 70%;'>" .   $row['lname'] . "</div><div class='reason1' style='width: 29%;'>Category:<br /> ".   $row['category'] . "</div></div>";

echo "<div class='reasonbar'><div class='prod-title2' style='width: 70%;'>Contact:" . $row['contact'] . "</div><div class='reason2' style='width: 29%;'>Price: &pound;".    $row['price'] . "</div></div>";



echo "</td>";
echo "</tr>";
echo "</td>";
echo "</tr>";
echo "</table>";

echo "<div id='myModal' class='reveal-modal'>";
echo "<h1>Modal Title</h1>";
echo "<p>Contact:" . $row['contact'] . "</p>";
echo "<a class='close-reveal-modal'>&#215;</a>";
echo "</div>";

echo "<a href='#' data-reveal-id='myModal'>Click Me For A Modal</a>";


}


}

else
echo "No results found for \"<b>$search</b>\"";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:28:40+00:00Added an answer on June 11, 2026 at 5:28 pm

    From the link you gave:

    Just give your modal div the class "reveal-modal"and a unique ID (we'll use the ID to launch this modal) and By putting the "data-reveal-id" attribute on the anchor, when clicked the plugin matches the value of the "data-reveal-id" attribute (in this case "myModal") with an HTML element with that ID.

    At the moment you seem to be giving each modal the same id so all modal links will target the first one.

    echo "<div id='myModal".$count."' class='reveal-modal'>";
    echo "<h1>Modal Title</h1>";
    echo "<p>Contact:" . $row['contact'] . "</p>";
    echo "<a class='close-reveal-modal'>&#215;</a>";
    echo "</div>";
    
    echo "<a href='#' data-reveal-id='myModal".$count."'>Click Me For A Modal</a>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database application (or search engine) which is called Solr. I connect
I have a simple search engine which echo's out results in a table with
I have a Search Engine which draws from two different workbooks, one which the
I currently have a simple search engine which searches a column in my database
I have built UI, its like a search engine for BioProcess/Disease--> Genes. e.g., User
I have a jsf facelet which displays a summary of a search process. Now
I'm building an app which searches the web using search engine. I have one
I have simple search engine with paginated results in my codeigniter application. When I
I have written a local search engine in Python, which I feel was a
I have a problem. I want to create a search engine which is based

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.