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

Code Explained - 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

So what does the code in the previous section actually do? There are two rows of the table that need to be displayed based on the outcome of the $level variable check:


<?php if($level =="admin"){?>


If the value of the $level variable is admin, then the section of the code that you see above is built and displayed, based on the number of returned values from the query that we ran in the PHP portion of the page. The $num_admin variable is used in a while loop to extract the project name, status and creation date of the projects concerned. These details are then displayed in the resulting table rows that are created by this loop:


<tr>

<td><a href="view_project.php?pid=<?php echo $rowadmin['pid']?>"><?php echo $rowadmin['title'];?></a></td>

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

<td><?php echo $rowadmin['create_dt'];?>

</td>

</tr>


Notice that there is also a dynamic hyperlink created with the title of the project. This link will enable the user to view the project concerned in detail when it is clicked. If the $num_admin variable value is zero -- in other words, no records could be found for this user -- then another dynamic table row is built to display this message:


}else{ ?>

<tr>

<td colspan="3"><p>There does not seem to be any projects registered in your name. Click on the "Create New Project" link to create a project.</p></td>

</tr>

<?php

}?>


If the $level variable contains the "normal" value, then exactly the same sequence of events as described above occurs, except that the key variables that are used for the "while" loop and the variable used to extract the results of the query is different. Also, the records retrieved are specific to the logged-in user's ID. In other words, only the projects with a user ID that is the same as that of the logged-in user will be retrieved and displayed.

That is all there is to the main page. The next page deals with looking at a particular project in detail. In fact, the hyperlink that is created by the dynamic table above opens this page when it is clicked, and lists all the details of a project. It lists how many staff are working on the project, their names, and the names of the files that are used in the project. Below is a screen shot of what the page looks like:




 
 
>>> 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: