prepare($sql); $stm->execute([ ':title' => $title, ':text' => $text, ':rating' => $rating, ':business' => $business, ':address' => $address, ':reviewer' => $_SESSION['reviewer_id'], ]); /** * All is well, so redirect back to the business with the message that the review was added. */ header('Location: /business.php?id=' . $_POST['business'] . '&msg=review_added'); exit; } else { /** * Redirect back to the business with the error message that some parameters were missing. */ header('Location: /business.php?id=' . $_POST['business'] . '&err=missing_params#add-review'); exit; } } /** * If the code execution reaches this point, then some parameters were incorrect or missing. Redirect to the list of businesses with an appropriate error message. */ header('Location: /businesses.php?err=missing_params'); exit;