-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zach
committed
Apr 25, 2019
1 parent
a6f39d4
commit 0f2e5d6
Showing
6 changed files
with
73 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,37 @@ | ||
<?php | ||
require('../header.php'); | ||
require '../database-info.php'; | ||
require '../databaseFunctions.php'; | ||
/* | ||
if(isset($_GET['editTaskItem'])){ | ||
$id = $_GET['editTaskItem']; | ||
$sql = editTaskItem($id); | ||
$stmt = $pdo-prepare ($sql); | ||
$stmt->execute (); | ||
} | ||
*/ | ||
if(isset($_GET['editTaskItem'])){ | ||
$id = $_GET['editTaskItem']; | ||
require ('../header.php'); | ||
require ('../database-info.php'); | ||
require ('../databaseFunctions.php'); | ||
|
||
$id = $_GET['id']; | ||
$sql = selectToDoListItem($id); | ||
$stmt = $pdo-prepare ($sql); | ||
$stmt = $pdo->prepare ($sql); | ||
$stmt->execute (); | ||
} | ||
?> | ||
$row = $stmt -> fetch(); | ||
|
||
<form class="form"> | ||
<label>Name:</label> | ||
<input type="text" value="<?=$row['ToDoName'];?>"/> | ||
?> | ||
<div class="container"> | ||
<form action="editTaskHandling.php" method="POST" class="form-inline justify-content-center"> | ||
<input type="hidden" value="<?=$id;?>" name="toDoID" /> | ||
<div class="form-group col-12"> | ||
<label class="text-center">Name:</label> | ||
<input type="text" class="form-control" name="itemName" value="<?=$row['ToDoName'];?>"/> | ||
</div> | ||
<div class="form-group col-12"> | ||
<label>Description:</label> | ||
<input type="text" value="<?=$row['ToDoName'];?>"/> | ||
<input type="text" class="form-control" name="itemDescription" value="<?=$row['ToDoDescription'];?>"/> | ||
</div> | ||
<div class="form-group col-12"> | ||
<label>Due Date:</label> | ||
<input type="date" class="form-control" name="itemDueDate" value="<?=$row['ToDoDueDate'];?>"/> | ||
</div> | ||
<input type="submit" class="col bg-success btn text-white mt-2" value="Update Changes"/> | ||
</form> | ||
<a href="#" onclick="closeWindow()" class="btn col bg-primary text-white mb-3">Cancel Changes</a> | ||
|
||
<input type="submit" value="Update"/> | ||
</form> | ||
</div> | ||
<script> | ||
function closeWindow(){ | ||
window.close(); | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
require ('../database-info.php'); | ||
require ('../databaseFunctions.php'); | ||
try { | ||
$id = $_POST['toDoID']; | ||
$name = $_POST['itemName']; | ||
$description = $_POST['itemDescription']; | ||
$dueDate = $_POST['itemDueDate']; | ||
$sql = editTaskItem($id); | ||
$stmt = $pdo->prepare($sql); | ||
$stmt->bindValue (':name', $name); | ||
$stmt->bindValue (':description', $description); | ||
$stmt->bindValue (':date', $dueDate); | ||
$stmt->execute (); | ||
} catch(Exception $e){ | ||
echo "Error while updating data " . $e->getMessage() , "\n"; | ||
} | ||
echo "Successfully updated item! <script>window.close();</script>"; | ||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters