I am new to PHP, and I am making a website about cars. I am using PDO and following the MVC pattern. Now when a user retrieves information about cars on my website, they have the option to 'View more details' of the car and you can imagine that the query the user performs will retrieve 30 cars +, I understand that creating a new page for each one of these cars retrieved would be ridiculous so I am wondering how may I come across creating a new page for that specific car when the 'View more details is clicked'
For example, Facebook doesn't manually create profile pages for each user it just automatically does it when the profile is clicked to view, this is all I have got so far(if it helps):
<?php if(isset($view->CarData2))
{
if (count($view->CarData2) > 0){
foreach($view->CarData2 as $ResultCarData) {
echo '<div class="row">';
echo '<div class="col-sm-6 col-md-4">';
echo '<div class="thumbnail">';
echo '<img src="" alt=""/>';
echo '<div class="caption">';
echo '<h2></h2>';
echo '<h4 class="colouredTitle">Make: </h4>';
echo '<h4>' .$ResultCarData->getMake(). '</h4>';
echo '<h4 class="colouredTitle">Model: </h4>';
echo '<h4>' .$ResultCarData->getModel(). '</h4>';
echo '<h4 class="colouredTitle">Type: </h4>';
echo '<h4>' .$ResultCarData->getType(). '</h4>';
echo '<h4 class="colouredTitle">Colour: </h4>';
echo '<h4>' .$ResultCarData->getColour(). '</h4>';
echo '<h4 class="colouredTitle">Year: </h4>';
echo '<h4>' .$ResultCarData->getYear(). '</h4>';
echo '<h4 class="colouredTitle">Price: </h4>';
echo '<h4>' .$ResultCarData->getPrice(). '</h4>';
echo '<button class="btn btn-success" name="view" type="submit" >View more details</button>';
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
}
}
else
{
echo 'No results found';
}
};
?>
Just to summarize what this does, it basically creates these new elements a certain amount of times depending on how many results are retrieved from the users query, it then displays the results in the appropriate areas.
Now my question is, how would I loop new pages when the 'view more details' is clicked? So if the button is clicked create a separate page where the user can view that specific car in more details