I am trying to make a Q/A webpage. I fetched the data from database through PHP which looks like:
Now, how can I make each data clickable, so that after clicking on specific question, It will open a modal or a new page where the data of clicked question goes.
My code is:
<?php
//Start to show '...' after 200 words.
function limited_echo($x, $length){
if(strlen($x)<=$length){
echo $x;}
else{
$y=substr($x,0,$length) . '...';
echo $y;}}
//End Here
//Main Code
include_once 'inc/connection.php';
$record= "SELECT * FROM questions";
$getdata = mysqli_query($link,$record);
if(! $getdata ) {
die('Could not get data');
}
while($row = mysqli_fetch_array($getdata)){
?>
<div class="section">
<h1><?php echo "{$row['title']}"; ?></h1>
<p><?php limited_echo($row['description'], 200); ?></p>
</div>
<?php
}
?>
Hope, This information is enough. If anything extra needed please let me know.