PHP
  Home arrow PHP arrow Page 4 - Making Changes in 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

Making Changes in a Project Management Application
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 3
    2008-06-16


    Table of Contents:
  • Making Changes in a Project Management Application
  • PHP Explained
  • HTML Form
  • Determining the Value of the Variable

  • 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


    Making Changes in a Project Management Application - Determining the Value of the Variable
    ( Page 4 of 4 )

    One of the three values is contained in the $projectdetails['status'] variable. The only difficulty here is that you need to show the other two values in case the user wants to change from the current status. For example, say the status of the project is 'pending.' The user loads the edit_project page and that is the status that he should see on the form. However, the user must also be able to change that status to any of the other two states (overdue and completed).

    So, we need to create a select box that will show the current status of the project as well as give the user the option to change the status. The logical steps to take in this case, are to first determine what value is in the $projectdetails['status'] variable, and then use the select box 'selected' attribute to select that value. I've used the switch() structure to do that work for me:

    <select name="status" id="status">

    <?php

    $list=array('overdue','completed','pending');


    switch($projectdetails['status']){

     

    case "overdue":

    echo "<option value='overdue'

    selected";

     

    break;

    case "completed":

    echo "<option value='completed'

    selected";

     

    break;

    case "pending":

    echo "<option value='pending'

    selected";

     

    break;

    }


    Once I've determined what the value of the variable is and selected it, I then run a for() loop and list all three values in the select box. You will see that I created an array called $list (highlighted in red above) that contains all three values:


    for($x=0; $x < 4; $x++){

    echo ">" .$list[$x]. "</option>";

    }

    ?>

    </select>

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

    </label></td>

    </tr>

    <tr>

    <td>Date Due </td>

    <td><label>

    <?

    $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 type="hidden" name="createdt" value="<?php echo $projectdetails['create_dt']?>" />

    </label></td>

    </tr>

    <tr>

    <td>&nbsp;</td>

    <td><label>

    <input name="submit" type="submit" id="submit" value="Update!" />

    </label></td>

    </tr>

    </table>


    </form>

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

    </tr>

    <tr>

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

    <tr>

    <td><a href="edit_task.php?pid=<?php echo $projectdetails['pid'];?>">Change a Task in this Project</a> | <a href="edit_staff.php?pid=<?php echo $projectdetails['pid'];?>">Change Staff members of this Project </a> | <a href="main.php">View Project List</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>


    That's all there is to the edit project script. The next article will look at adding, editing, and viewing tasks for a particular project.



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

       

    PHP ARTICLES

    - 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
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





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