PHP
  Home arrow PHP arrow Adding Tasks to a Project Management Application
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Adding Tasks to a Project Management Application
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 1
    2008-06-23


    Table of Contents:
  • Adding Tasks to a Project Management Application
  • Code Explained
  • Date Building Code Explained
  • View Tasks Script

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Adding Tasks to a Project Management Application
    ( Page 1 of 4 )

    The previous articles covered adding, editing and viewing a project, capabilities any project management application needs. The next couple of articles will cover the "optional" parts of the application. They include adding project files and adding tasks to a project, both of which are not strictly necessary. We will also look at adding staff members to a particular project a little later on. This article, the fourth of seven parts, will deal with adding tasks to a project, after which we will look at editing a task.

    A task in this case refer to a action that the project manager wants done by a certain date or time. The tasks for the project are not displayed on the view project page (the page that shows project contents in detail). Instead, you get a link that points you toward the different tasks that should be done on the given project.

    The only link between all the scripts that deal with handling tasks, and the project itself, is the project id. As you may remember, all database tables for this application have a project id in them. So in order for this script work effectively, it will need to be given a project id by whatever script is referencing it. Otherwise the task that you create cannot be linked to any project. Below is a screen shot of what the page actually looks like:


    And as always, here's the entire code for the page:



    <?php

    include "dbcon.php";

    include "functions.php";


    $cpid=mysql_escape_String($_GET['pid']);


    $getname = "SELECT title FROM projects WHERE pid = '".$cpid."'";

    $g_result = mysql_query($getname);

    if(!$g_result){

    echo mysql_error();

    }else{

    $rowname = mysql_fetch_assoc($g_result);

    $title = $row['title'];

    }




    if(isset($_POST['submit'])){

    //check vars

    $descr=mysql_escape_string($_POST['descr']);

    $p_pid=mysql_escape_string($_POST['p_pid']);


    //due date

    $duedt = $_POST['yy'] . "-";

    if($_POST['mm'] < 10) {

    $duedt .= "0";

    }

    $duedt .= $_POST['mm'] . "-";

    if($_POST['mm'] == 4 || $_POST['mm'] == 6 || $_POST['mm'] == 9 || $_POST['mm'] == 11) {

    if($_POST['dd'] > 30) {

    $duedt .= "30";

    } else {

    $duedt .= $_POST['dd'];

    }

    } elseif($_POST['mm'] == 2) {

    if($_POST['yy'] == 2008 || $_POST['yy'] == 2012) {

    if($_POST['dd'] > 29) {

    $duedt .= "29";

    } else {

    $duedt .= $_POST['dd'];

    }

    } else {

    if($_POST['dd'] > 28) {

    $duedt .= "28";

    } else {

    $duedt .= $_POST['dd'];

    }

    }

    } else {

    $duedt .= $_POST['dd'];

    }

     

    //insert

    $insert = "INSERT INTO tasks SET task_description = '".$descr."',";

    $insert .= "complete_by = '".$duedt."',p_id= '".$p_pid."'";

    if(!mysql_query($insert)){

    echo mysql_error();

    }

    }

    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/PM_Main.dwt.php" codeOutsideHTMLIsLocked="false" -->

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <!-- InstanceBeginEditable name="doctitle" -->

    <title>Untitled Document</title>

    <!-- InstanceEndEditable -->

    <!-- InstanceBeginEditable name="head" -->

    <!-- InstanceEndEditable -->

    <link href="Templates/main.css" rel="stylesheet" type="text/css" />

    </head>


    <body>

    <table width="100%" border="0">

    <tr>

    <td width="33%">&nbsp;</td>

    <td width="28%">&nbsp;</td>

    <td width="39%">Logged in: <!-- InstanceBeginEditable name="login" --><? echo $_SESSION['name'];?> | <a href="logout.php">Logout</a><!-- InstanceEndEditable --></td>

    </tr>

    <tr>

    <td colspan="3" bgcolor="#6699CC" class="headertxt">Project Management Software </td>

    </tr>

    <tr>

    <td colspan="3"><!-- InstanceBeginEditable name="main" -->

    <form action="add_task.php" method="post" name="f1">

     

    <table width="100%" border="0">

    <tr>

    <td colspan="2" class="loginheader"><?php echo $title;?></td>

    </tr>

    <tr>

    <td>&nbsp;</td>

    <td>&nbsp;</td>

    </tr>

    <tr>

    <td>Complete by</td>

    <td><?php $dd = date("d");

    $mm = date("m");

    $yy = date("Y");

    echo "<select name="dd">n";

    for($i = 1; $i <= 31; $i++) {

    echo "<option value="" . $i . """;

    if($i == $dd) {

    echo " selected";

    }

    echo ">" . $i . "</option>n";

    }

    echo "</select>&nbsp;<select name="mm">n";

    for($i = 1; $i <= 12; $i++) {

    echo "<option value="" . $i . """;

    if($i == $mm) {

    echo " selected";

    }

    echo ">" . $month_names[$i] . "</option>n";

    }

    echo "</select>&nbsp;<select name="yy">n";

    for($i = $yy; $i <= ($yy + 1); $i++) {

    echo "<option value="" . $i . """;

    if($i == $yy) {

    echo " selected";

    }

    echo ">" . $i . "</option>n";

    }

    echo "</select>";

    ?> <input name="p_pid" type="hidden" value="<?php echo $_GET['pid']?>" /></td>

    </tr>

    <tr>

    <td valign="top">Description</td>

    <td><label>

    <textarea name="textarea"></textarea>

    </label></td>

    </tr>

    <tr>

    <td>&nbsp;</td>

    <td><label>

    <input type="submit" name="submit" value="Add task!" />

    </label></td>

    </tr>

    </table>

     

    </form>

    <!-- InstanceEndEditable --></td>

    </tr>

    <tr>

    <td colspan="3"><!-- InstanceBeginEditable name="nav" --><a href="main.php">View Project List</a> | <a href="admin/login.php">Administrators Corner </a><!-- InstanceEndEditable --></td>

    </tr>

    <tr>

    <td align="right" class="cright" colspan="3">copyright &copy; 2007 PM </td>

    </tr>

    </table>

    </body><!-- InstanceEnd -->

    </html>



     
     
    >>> More PHP Articles          >>> More By David Web
     

       

    PHP ARTICLES

    - Using Directory Iterators to Build Loader Ap...
    - Using the spl_autoload() Functions to Build ...
    - Working Out of the Object Context to Build L...
    - Using the _autoload() Magic Function to Buil...
    - The Destruct Magic Function in PHP 5
    - The Autoload Magic Function in PHP 5
    - Developing a Recursive Loading Class for Loa...
    - The Sleep and Wakeup Magic Functions in PHP 5
    - Using the Clone Magic Function in PHP 5
    - Including Files Recursively with Loader Appl...
    - The Call Magic Function in PHP 5
    - Designing a Captcha System with PHP and MySQL
    - Using Static Methods to Build Loader Apps in...
    - The Isset and Unset Magic Functions in PHP 5
    - Advanced PHP Form Input Validation to Check ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT