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> <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> <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> </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 © 2007 PM </td> </tr> </table> </body><!-- InstanceEnd -->
blog comments powered by Disqus |
|
|
|
|
|
|
|