I have a php based webpage. This pulls product order history as so:
$sql = "SELECT * FROM products WHERE userid=$userid ";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0){
while ($row = mysqli_fetch_assoc($result)){
$product_name = $row["product_name"];
$order_id = $row["order_id"];
}}
If a user wants to select to view more information on the order I use a form as such: (which gets the product_id so I can pass it on the next page then use it to call data from the sql database)
<input type='hidden' name='order_id' >
This means that the url displayed is www.mywebsite.com/order (opens order.php which has the code above). It is not specific to the product/order. I see all websites have something like www.website.com/myorders/order1A2312
- Do I need it to make a new webpage each time? Because everytime someone presses back it will display an error as nothing is pushed during the button press.
Short Question: Is it good practice to rely on a single php page to call data? Or shall I make it specific to a user and order.