예제 #1
0
<?php

require_once 'class.toDoInput.php';
$myList = new toDoList();
$error = 0;
# Setup page information and execute code based on which button was pressed
switch ($_POST["btn_action"]) {
    case "Add Item":
        $btn_value = "Add Item";
        $action = "add";
        break;
    case "Delete Item":
        if (!$_POST["Itemid"]) {
            header("location: index.php");
            exit;
        }
        $myList->removeItem($_POST["Itemid"]);
        break;
        #This doesnt work yet
    #This doesnt work yet
    case "Change completion":
        if (!$_POST["Itemid"]) {
            if ($complete) {
                $complete = 0;
            } else {
                $complete = 1;
            }
            header("location: index.php");
            exit;
        }
        break;
예제 #2
0
if (isset($_GET["success"])) {
    switch ($_GET["success"]) {
        case "add":
            echo "<p class='success-label'>item added successfully.</p>";
            break;
        case "delete":
            echo "<p class='success-label'>item removed successfully.</p>";
            break;
        case "edit":
            echo "<p class='success-label'>item updated successfully.</p>";
            break;
    }
}
?>
				
			<div class="bk3">
				<?php 
$myList = new toDoList();
# Instantiate an Object using our toDoList Class
$myList->displayItems();
# Call the displayPotions method through the new Object
?>
			</div>
		</div>

		<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

		<script type="text/javascript" src="script.js"></script>
		
	</body>
</html>