Jump to content

Recommended Posts

I have a Job List with different fields. I would like a column that would have the ability to click on C(ompleted) and when you check it off it will post these jobs to a new web page of completed jobs. Actually, instead of having the Delete choice, I would like a C(ompleted) choice with the V(iew) and E(dit) I can't figure out how to do this. Any help would be appreciated. Here is the site:
[a href=\"http://jobboard.bernardtransportation.com/jobs.php?posting=yes&\" target=\"_blank\"]http://jobboard.bernardtransportation.com/...hp?posting=yes&[/a]
Please don't delete any entries or make any radical changes to the Job List.
Here's one way

[code]<?php
if (isset($_GET['action'])) {
    $id = $_GET['id'];
    
    switch ($_GET['action']) {
        case 'D':
            # delete rec with id = $id  here
            echo "Deleting $id";
            break;
            
        case 'V':
            /*
            # display rec with id = $id
            # eg
                header("location: taskdetail.php?id=$id");
                exit;
            */
            echo "Viewing $id";
            break;
            
        case 'E':
            /*
            # display edit form for rec with id = $id
            # eg
                header("location: taskedit.php?id=$id");
                exit;
            */
            echo "Editing $id";
            break;
    }
            
}
?>
<hr/>
Task 1 <a href='?action=V&amp;id=1'>View</a> <a href='?action=E&amp;id=1'>Edit</a> <a href='?action=D&amp;id=1'>Delete</a>
<br />
Task 2 <a href='?action=V&amp;id=2'>View</a> <a href='?action=E&amp;id=2'>Edit</a> <a href='?action=D&amp;id=2'>Delete</a>
<br />
Task 3 <a href='?action=V&amp;id=3'>View</a> <a href='?action=E&amp;id=3'>Edit</a> <a href='?action=D&amp;id=3'>Delete</a>
<br />[/code]
Barry,

Thank you so much for writing back. I appreciate your trying to help with the code. However, I already have the capability to View Edit and Delete. What I need is the code for one of the Options to be [b]Complete[/b] or [b]Done[/b], INSTEAD of Delete, and for the items once completed to be posted to a new page, complete.php. Is that something that is feasible?

Again, thank you so much for offering to help.

Jeannie
My preferred method is to put a checkbox against each item. Give the checkboxes the same name, something like "done_task[]" and give each the value of the task id

[code]TASK 1 <input type='checkbox' name='done_task[]' value='$task_id'>[/code]

When you process

[code]if (isset($_POST['done_task'])) {

        $done_id_list = join (",", $_POST['done_task']);

        mysql_query ("UPDATE tasks SET completed = 1 WHERE id IN ($done_id_list)");
}[/code]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.