finalize the edit function

the edit function can now update all the relevant fields
This commit is contained in:
Andreas Zweili 2017-02-17 14:13:22 +01:00
parent 8e061ec901
commit 7380999487
1 changed files with 6 additions and 4 deletions

View File

@ -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");
}