Show data and click on it to open

1

I have a question. I'm doing a job where I have a page that shows the name of a club.

 while($exibe = mysql_fetch_array($qr)){

 echo '<p><h2>'.$exibe['Nome'].'</h2></p>';
 }

And I want you to click on the name or a button on the front to show me the whole information of this Club on another page.

 while($exibe = mysql_fetch_array($qr)){

 echo'<div id="tabs-1">
 <img align="right" src="logos/'.$exibe["Nome"].'.jpg">
       <p>Nome:<b>'.$exibe["Nome"].'</b></p>
       <p>Morada:   '.$exibe["Morada"].'</p>
       <p>Distrito: '.$exibe["Distrito"].'</p>
       <p>Concelho: '.$exibe["Concelho"].'</p>
    
asked by anonymous 29.04.2014 / 13:21

2 answers

2

If you want to redirect the information by clicking on the name you should create a for such page passing some identification. Let's say that your page that will receive the information after clicking the link is called outrapagina.php and wanted to search for id data, just put outrapagina.php?id= and your code

while($exibe = mysql_fetch_array($qr))
{
 echo '<p><h2><a href="outrapagina.php?id='.$exibe['id'].'">'.$exibe['Nome'].'</a></h2></p>';
}
    
29.04.2014 / 13:38
2

You should create a redirect to another page and filter in your database with the id of the previous page.

while($exibe = mysql_fetch_array($qr))
{
 echo '<p><h2><a href="outrapagina.php?id='.$exibe['id'].'">'.$exibe['Nome'].'</a></h2></p>';
}

this you put on your main page, and in the other page.php, you should redeem the id passed by the previous page

// resgata o id passado por url
$id = $_GET['id'];

//filtra os dados conforme o id;
$sql = mysql_query("select * from SUABASE where id = $id;");
$exibe = mysql_fetch_array($sql);

echo'<div id="tabs-1">
 <img align="right" src="logos/'.$exibe["Nome"].'.jpg">
       <p>Nome:<b>'.$exibe["Nome"].'</b></p>
       <p>Morada:   '.$exibe["Morada"].'</p>
       <p>Distrito: '.$exibe["Distrito"].'</p>
       <p>Concelho: '.$exibe["Concelho"].'</p>
    
29.04.2014 / 13:57