I'm a beginner in coding. I'm having an issue on how to go about creating this component of my web project: I'm trying to make a review website sort of like yelp. The user clicks on a link about subject A and will see a list of reviews about subject A. And so on if the user clicks on a link for subject B, C, D etc. However, I don't want to create individual php pages for each link for each subject example of what I'm talking about:
<a href="subjectA.php">subjectA</a>
<a href="subjectB.php">subjectB</a>
and so on, because then I would end up with like 20 php files (I have a lot of subjects that the user can review on). Each subject has the same css and page format but different content. Whats a much better and practical solution to this because I know my way is not the best. For this project I can only use html,php and js.
Thanks.
You need to have 2 web pages in the same directory, subjectA.php and subjectB.php
To create a php page you can use any text editor but you must have apache server install and running to run php file.
<?php
//your code goes here..
?>
Since it's just a project. I won't go too much into detail but would give you a simple idea:
You can do something like this:
# Home.php
<a href="checkOutReviews.php?subject=1">Subject One</a>
<a href="checkOutReviews.php?subject=2">Subject Two</a>
....
....
And then,
# checkOutReviews.php
$subject_id = $_GET['subject'];
/** Get subject details from the database or any other storage of your choice **/
/** and just display them **/
This way you won't have to create pages for each of your subjects.