Home arrow PHP arrow Page 3 - Adding Tasks to a Project Management Application

Date Building Code Explained - PHP

The previous articles covered adding, editing and viewing a project, capabilities any project management application needs. The next couple of articles will cover the "optional" parts of the application. They include adding project files and adding tasks to a project, both of which are not strictly necessary. We will also look at adding staff members to a particular project a little later on. This article, the fourth of seven parts, will deal with adding tasks to a project, after which we will look at editing a task.

TABLE OF CONTENTS:
  1. Adding Tasks to a Project Management Application
  2. Code Explained
  3. Date Building Code Explained
  4. View Tasks Script
By: David Web
Rating: starstarstarstarstar / 1
June 23, 2008

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

The date building code sends the following form variables up to the PHP portion of the page:

$_POST['yy']

$_POST['mm']

$_POST['dd']


The three represent the year, month and day portions of the date that the user selects from the select boxes. Then when these parts are processed, they are basically concatenated and separated by the dash (-) sign. So the end result is "yyyy-mm-dd" which is the format used by MySQL:


<?php $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>";


Also notice that a hidden field is created with a project id value. This value is received directly from the sending script and is very important in the sense that it provides the link between the task and the project itself:


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


</tr>

<tr>

<td valign="top">Description</td>

<td><label>

<textarea name="textarea"></textarea>

</label></td>

</tr>

<tr>

<td>&nbsp;</td>

<td><label>

<input type="submit" name="submit" value="Add task!" />

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




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