PHP
  Home arrow PHP arrow Viewing and Editing Tasks for 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? 
Google.com  
PHP

Viewing and Editing Tasks for a Project Management Application
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 2
    2008-06-30


    Table of Contents:
  • Viewing and Editing Tasks for a Project Management Application
  • The edit_task script
  • Script Explained
  • HTML Form

  • 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


    Viewing and Editing Tasks for a Project Management Application
    ( Page 1 of 4 )

    Welcome to the fifth part of a seven part series on building a project management application. In the last article we looked at the view_tasks.php script. Specifically, we looked at the PHP portion of the script in detail. In this article we will finish discussing that script by examining the HTML portion. We will then move on to discuss the edit_task.php script, which is responsible for handling any changes that the user makes to a task.

    To create the dynamic HTML table for the view task script, PHP is going to use the $num variable that it stored in the PHP portion of the page. The table headers are:

    • Description
    • To be completed by

    These headers are static and will not be affected by the dynamic aspect of the code. Let's look at how it is done:


    <!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" -->

    <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>Task Description: </td>

    <td>To be completed by: </td>

    </tr>


    The dynamic rows start here. First, PHP checks to see how many table rows it will need to create:


    <?php

    if($num > 0){

    Then it creates a while() loop that will actually create rows based on the number of results. The $num variable stores a number, so if the number is, for example, five, then the number of rows that are created will also be five. Now, as these rows are created, PHP adds the description and "complete by" dates to the table:


    while($row = mysql_fetch_assoc($result)){?>

    <tr>

    <td><?php echo $row['task_description']?></td>

    <td><?php echo $row['complete_by']?></td>

    </tr>

    <?php

    }


    If the $num variable does not contain any numbers, it means that no tasks were available for the given project. An appropriate message will be given:


    }else{

    ?>

     

    <tr>

    <td colspan="2"><p>There are no tasks registered for this project.</p></td>

    </tr>

    <?php }

     

    ?>

    </table>

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

    </tr>

    <tr>

    <td colspan="3"><!-- InstanceBeginEditable name="nav" --><table width="100%" border="0">


    The view tasks page has two navigation links at the bottom that take you either to the Administrator's corner or the edit tasks page. We are going to be looking at the edit tasks page in the next section:


    <tr>

    <td><a href="edit_task.php?pid=<?php echo $_GET['pid'];?>">Edit Task</a> | <a href="admin/login.php">Administrators Corner </a></td>

    </tr>

    </table><!-- 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

    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek