Home arrow PHP arrow Page 3 - HTML for a Project Management Application

Source Code for the Page - PHP

In this article we will continue discussing the HTML portion of the main.php page and then move on to the page that enables you to view a project in detail. This is the second part of a seven-part article that covers the creation of a project management application.

TABLE OF CONTENTS:
  1. HTML for a Project Management Application
  2. Code Explained
  3. Source Code for the Page
  4. PHP explained
By: David Web
Rating: starstarstarstarstar / 5
June 09, 2008

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

And here's the code for the entire page, including the PHP portion of it:


viewproject

<?php

include "dbcon.php";

include "functions.php";

//initialise variables

$alert =false;

// retrieve information based on the user id, that we set in the login page:


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

//get projects

$projectID = mysql_escape_string($_GET['pid']);

$getproject= "SELECT * FROM projects WHERE pid = '".$projectID."'";

$results = mysql_query($getproject);

$projectdetails = mysql_fetch_assoc($results);


//get project files

$getfiles = "SELECT * FROM files WHERE p_id = '".$projectID."'";

$file_res = mysql_query($getfiles);

if(!$file_res){

echo mysql_error();

}else{

$num_files = mysql_num_rows($file_res);

}

 

//get project members

$getmembers = "SELECT name FROM staff WHERE p_id = '".$projectID."'";

$staff_res = mysql_query($getmembers);

if(!$staff_res){

echo mysql_error();

}else{

$num_staff = mysql_num_rows($staff_res);

}



}

?>


<!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>Project Management::View Project</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"><div align="left">Project Name: <?php echo $projectdetails['title'];?> </div></td>

</tr>

<tr>

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

<td width="56%" ></td>

</tr>

<tr>

<td valign="top"><table width="100%" border="0">

<tr>

<td colspan="2"><b>Project Details</b> </td>

</tr>

 

<tr>

<td>Owner</td>

<td><?php echo $_SESSION['name'];?> </td>

</tr>

<tr>

<td>Due Date </td>

<td><?php

if($projectdetails['due_dt'] > $td){

$alert = true;

}

echo $projectdetails['due_dt'];?> </td>

</tr>

<tr>

<td>Status</td>

<td><?php echo $projectdetails['status'];?></td>

</tr>

<tr>

<td>Project Description</td>

<td><?php echo $projectdetails['project_description'];?></td>

</tr>

</table></td>

<td rowspan="2" valign="top"><table width="83%" border="0" align="right">

 

<tr>

<td><b>Project Files:</b> </td>

</tr>

<?php if($num_files > 0){

while($row = mysql_fetch_assoc($file_res)){

?>

<tr>

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

</tr>

<?php }

}else{

 

?>

<tr>

<td><p>There are no files stored for this project</p></td>

</tr>

<?php

}

?>

</table></td>

</tr>

<tr>

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

<tr>

<td><b>Project Staff</b> </td>

</tr>

<?php

if($num_staff > 0){

while($rowstaff = mysql_fetch_assoc($staff_res)){

?>

 

<tr>

<td><?php echo $rowstaff['name'] ?> </td>

</tr>

<?php

}

}else{

?>

<tr>

<td><p>There are no other staff members registered for this project</p></td>

</tr>

<?php

}

?>

</table></td>

</tr>

</table>

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

</tr>

<tr>

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

<tr>

<td><a href="edit_project.php?pid=<?php echo $projectdetails['pid'];?>">Edit Project</a> |<a href="add_project.php">Add Project</a> | <a href="add_file.php?pid=<?php echo $projectdetails['pid'];?>">Add Files to this Project </a> |<a href="view_tasks.php?pid=<?php echo $projectdetails['pid'];?
>">View Tasks for this Project</a> | <a href="add_task.php?pid=<?php echo $projectdetails['pid'];?>">Add a Task to this Project</a> | <a href="add_staff.php?pid=<?php echo $projectdetails['pid'];?>">Add Staff to the Project</a> | <a href="admin/login.php">Administrators Corner</a>|<a href="main.php">View Project List</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
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: