Question: PHP- Modify and Enhance the Application: Task List Manager This exercise gives you a chance to experiment with arrays and array methods in the context

PHP- Modify and Enhance the Application: Task List Manager

This exercise gives you a chance to experiment with arrays and array methods in the context of the Task List Manager application. Open and test the application

1. Run the application in the ex_starts/chll exl directory. This is a modified version of the Task List Manager application that has a Modify Task button, a Promote Task button, and a Sort Tasks button.

2.Test this application by using the Add Task button to enter three tasks and the Delete Task button to delete one of the tasks. These buttons should work as described in the text. However, the other buttons shouldn't do anything.

3. Open the index.php and task list.php files for this application. Note that these files use the name and value attributes of the submit buttons to get the action to be performed. Display the contents of an array in the browser

4. In the task_list.php file, just inside the tag, add the following code: Save your changes and run the application. You should see the indexes and values for the Stask_list array in the browser

5. Modify and enhance the application

6. Modify the code for adding a task so it uses the array_push function to adda new task to the end of the task_list array. Then, test this change.

7. Add code that lets the user modify an existing task. If the user clicks on the Modify Task button, this code should hide the form that contains the Modify Task button, and it should display the form that's included in the task_list.php file. This form displays the current task in a text box and includes buttons that lets users save or cancel their changes.

8. Add code that allows the user to promote a task. This code should move the selected task up one index in the array of tasks. If the user selects the first , this code should display an error that indicates that you can't promote the first task .

9. Add code that lets the user sort all tasks alphabetically

Hello All! I need help plzz. I am trying to modify an array within my code and also add a save, delete, and sort option to my form. I have no idea how to or even know where to begin with this. I am using Netbeans to test my code as an FYI. Here is my code so far:

HMTL Form Code: Task_List.php

Task List Manager

Task List Manager

0) : ?>

Errors:

Tasks:

There are no tasks in the task list.

    $task ) : ?>

Add Task:

0 && empty($task_to_modify)) : ?>

Select Task:

Task to Modify:

PHP Code: Index.php

}

//get action variable from POST $action = filter_input(INPUT_POST, 'action');

//initialize error messages array $errors = array();

//process switch( $action ) { case 'Add Task': $new_task = filter_input(INPUT_POST, 'newtask'); if (empty($new_task)) { $errors[] = 'The new task cannot be empty.'; } else { $task_list[] = $new_task; } break; case 'Delete Task': $task_index = filter_input(INPUT_POST, 'taskid', FILTER_VALIDATE_INT); if ($task_index === NULL || $task_index === FALSE) { $errors[] = 'The task cannot be deleted.'; } else { unset($task_list[$task_index]); $task_list = array_values($task_list); } break;

case 'Modify Task': $task_index = filter_input(INPUT_POST, 'taskid', FILTER_VALIDATE_INT); $task_index = $task_to_modify; break; case 'Sort Tasks': $task_index = filter_input(INPUT_POST, 'tasklist[]', FILTER_VALIDATE_INT); $task_index = SORT_STRING; sort($task_index); break; /* case 'Save Changes': case 'Cancel Changes': case 'Promote Task': case 'Sort Tasks': */ }

include('task_list.php'); ?>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!