From 73809994875852c0dba29f334380ba060b9e129f Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Fri, 17 Feb 2017 14:13:22 +0100 Subject: [PATCH] finalize the edit function the edit function can now update all the relevant fields --- functions.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/functions.php b/functions.php index 5e561a1..a83db06 100644 --- a/functions.php +++ b/functions.php @@ -120,17 +120,19 @@ function pbget($con) // A function to edit a demand function editpost($con) { - if (isset($_POST['submit'])) { + if (isset($_POST['edit'])) { global $con; - $userId = $_POST['userId']; $demandId = $_POST['demandId']; $piecesMax = $_POST['piecesMax']; $piecesMin = $_POST['piecesMin']; - $date = $_POST['date']; $text = $_POST['text']; // Inserts Updates Database - $sql = "UPDATE demands SET message='$message' WHERE demandId='$demandId'"; + $sql = "UPDATE demands + SET piecesMax='$piecesMax', + piecesMin='$piecesMin', + text='$text' + WHERE demandId='$demandId'"; $result = mysqli_query($con, $sql) or die(mysqli_error($con)); header("Location: board.php"); }