PHP
  Home arrow PHP arrow Completing the 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

Completing the Project Management Application
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 7
    2008-07-14


    Table of Contents:
  • Completing the Project Management Application
  • Code Explained
  • The view_staff script
  • 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


    Completing the Project Management Application
    ( Page 1 of 4 )

    In this article we are going to look at the last three scripts for this application. They deal with viewing the names of staff members who work on a project and adding staff to a project. They will also enable you to remove staff from a project. This article is the conclusion to a seven-part series.

    The add_staff script

    The add_staff page gives the project manager the option to add staff to the given project. The script presents the user with a form in which it provides a text field for the user to enter a staff member's name. Below is the entire code that makes up the page:


    <?php

    include "dbcon.php";

    include "functions.php";


    if(isset($_GET['pid'])){


    //clean pid

    if(!is_numeric($_GET['pid'])){

    //the value received is not numeric. redirect the user to login

    header("location:login.php");

    }

    //otherwise clean the received value for query use

    $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


    $sname=mysql_escape_string($_POST['s_name']);

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


    //insert

    $insert = "INSERT INTO staff SET name = '".$sname."',";

    $insert .= "p_id= '".$p_pid."'";

    if(!mysql_query($insert)){

    echo mysql_error();

    }else{

    header("location:main.php");

    }



    }

    ?>



    <!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 id="form1" name="form1" method="post" action="add_staff.php" >

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

    <tr>

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

    </tr>

    <tr>

    <td colspan="2"><?php if(isset($msg)){

    echo $msg;

    }?> </td>

    </tr>

    <tr>

    <td width="10%">Name </td>

    <td width="90%"><label>

    <input name="s_name" type="text" />

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

    </label></td>

    </tr>

    <tr>

    <td>&nbsp;</td>

    <td><label>

    <input type="submit" name="submit" value="Add Member to Project" />

    </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 3 hosted by Hostway
    Stay green...Green IT