I get some values from a database query (mysql). These values become saved into an array. With foreach I can display each row from the mysql table which complies the term. Now my question is how can I display specific value pairs on another page when the user click the list item?

e.g.

<a href="#" class="list-group-item ">
	<h4 class="list-group-item-heading">Noob</h4>
	<p class="list-group-item-text">Hi I am new at stackoverflow...</p>
</a>

In this case on another page should be displayed "Noob" and "Hi I am...". This should work for every list item. I search the web for any days but doesnt found something helpful.

<?php include( "list.php"); ?>
<div class="list-group">
    <?php foreach ($result as $key=>$row): ?> <a href="#" class="list-group-item ">
        <h4 class="list-group-item-heading"><?php echo $row['title']; ?></h4>
        <p class="list-group-item-text">
          <?php echo $row['description']; ?>
            </p>
          </a>    
    <?php endforeach; ?>
</div>

If you want an action on one page to affect another you must persist that information somewhere, and then access that information when you're building the new page.

How you implement that depends on your technology stack and your use case and tons of other factors. Learning about each of those implementations are their own specific questions in and of themselves, but here are you two basic options:

  1. Server - When someone clicks on an item - send an AJAX message back to the server. Save that value either in your application session within the web app or in your database. When a client requests the second page, check if there are any values to load in.
  2. Client - Persist on the client with localStorage or sessionStorage. Then when the new page loads, load that information as well.