PHP
  Home arrow PHP arrow Page 4 - Making Changes in a Project Management...
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
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: 4 stars4 stars4 stars4 stars4 stars / 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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

       

    PHP ARTICLES

    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...
    - Working with the Email Class in Code Igniter





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