diff --git a/productpage.php b/productpage.php index ed8a8d6..19ef8c6 100644 --- a/productpage.php +++ b/productpage.php @@ -368,43 +368,89 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0; + + = 1 && $rating <= 5 && !empty($comment)) { + + // SQL-Statement vorbereiten (wie im Screenshot: userID, productID, rating, comment) + $stmtInsertRev = mysqli_prepare( + $conn, + "INSERT INTO reviews (userID, productID, rating, comment) VALUES (?, ?, ?, ?)" + ); + + if ($stmtInsertRev) { + // "iiis" steht für: Integer, Integer, Integer, String + mysqli_stmt_bind_param( + $stmtInsertRev, + "iiis", + $userID, + $productId, + $rating, + $comment + ); + + mysqli_stmt_execute($stmtInsertRev); + mysqli_stmt_close($stmtInsertRev); + + // WICHTIG: Die Seite neu laden, damit das Formular bei einem Refresh (F5) nicht doppelt gesendet wird + header("Location: productpage.php?id=" . $productId); + exit; // Stoppt das Skript hier, da wir weiterleiten + } + } + } + ?> +

Füge deine Bewertung hinzu!

-
- + + + -
- - +
+ + - - + + - - + + - - + + - - -
+ + +
- + - -
+ + + +

Du musst eingeloggt sein, um eine Bewertung abzugeben.

+ + + +
- - - - -