Jump to content


Photo

Completed Task Column/Post to New Web Page


  • Please log in to reply
4 replies to this topic

#1 Jeannie109

Jeannie109
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 04 June 2006 - 04:09 PM

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.

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 05 June 2006 - 09:24 AM

Here's one way

<?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 />

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 Jeannie109

Jeannie109
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 05 June 2006 - 05:49 PM

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 Complete or Done, 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

#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 05 June 2006 - 08:17 PM

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

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

When you process

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

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#5 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 05 June 2006 - 08:37 PM

barry? aHAHahAHAHahHAAa ermm...yeah anyways,

in case it's not clear, with barand's ^ post, you would then select/echo items on each of your pages, based on the 'completed' field being set to 1 or not.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users