From c509a2d6aa9394fa7200d8fa11904914d8e81f06 Mon Sep 17 00:00:00 2001 From: arf20 Date: Tue, 19 Mar 2024 04:58:03 +0100 Subject: Order working --- order.php | 124 ++++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 93 insertions(+), 31 deletions(-) (limited to 'order.php') diff --git a/order.php b/order.php index 1dd8555..613e3e7 100644 --- a/order.php +++ b/order.php @@ -14,12 +14,29 @@ $type = $_SESSION["type"]; require_once "config.php"; // Get services -$sql = "SELECT id, name, type, billing FROM services"; +$sql = "SELECT id, name, type, billing, description FROM services"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); $services = $result->fetch_all(MYSQLI_ASSOC); +// POST actions +if ($_SERVER["REQUEST_METHOD"] == "POST") { + // add entry + $sql = "INSERT INTO orders (service, name, client, billing, comments) VALUES (?, ?, ?, ?, ?)"; + $stmt = mysqli_prepare($link, $sql); + mysqli_stmt_bind_param($stmt, "sssss", $param_service, $param_name, $param_client, $param_billing, $param_comments); + $param_service = $_POST["service"]; + $param_name = $_POST["name"]; + $param_client = $clientid; + $param_billing = $_POST["billing"]; + $param_comments = $_POST["comments"]; + + if (!mysqli_stmt_execute($stmt) || (mysqli_stmt_affected_rows($stmt) != 1)) { + echo "SQL error."; + } else header("location: ".$_SERVER['SCRIPT_NAME']); +} + function getservicebyid($id) { global $services; foreach ($services as $service) { @@ -29,6 +46,11 @@ function getservicebyid($id) { } } +function genoption($id, $name) { + return "" + ."
\n"; +} + ?> @@ -37,6 +59,39 @@ function getservicebyid($id) { ARFNET CSTIMS +
@@ -50,39 +105,46 @@ function getservicebyid($id) {

panel

Order a new service

-
+

- -
+

+                            
+
+

+
+ +
-- cgit v1.2.3