<?php | |
/******************************************************************************* | |
* Copyright (c) 2006 Eclipse Foundation and others. | |
* All rights reserved. This program and the accompanying materials | |
* are made available under the terms of the Eclipse Public License v1.0 | |
* which accompanies this distribution, and is available at | |
* http://www.eclipse.org/legal/epl-v10.html | |
* | |
* Contributors: | |
* Nathan Gervais (Eclipse Foundation)- initial API and implementation | |
*******************************************************************************/ | |
#***************************************************************************** | |
# | |
# add_category.php | |
# | |
# Author: Nathan Gervais | |
# Date: Nov 3rd, 2006 | |
# | |
# Description: | |
# This file adds a Category to the database | |
#**************************************************************************** | |
require_once ("includes/header.php"); | |
$prj_id = $_GET['prj_id'] ? $_GET['prj_id'] : $_POST['prj_id']; | |
$cat_id = $_GET['cat_id'] ? $_GET['cat_id'] : $_POST['cat_id']; | |
$submit = $_GET['submit'] ? $_GET['submit'] : $_POST['submit']; | |
if ($submit == "Edit Project Category") | |
{ | |
$shortname = htmlentities($_GET['shortname'] ? $_GET['shortname'] : $_POST['shortname']); | |
$description = htmlentities($_GET['description'] ? $_GET['description'] : $_POST['description']); | |
$query = "UPDATE project_categories set category_id = $cat_id, description = '$shortname', long_description = '$description' WHERE project_id = '$prj_id' AND category_id = $cat_id"; | |
$result = mysql_query($query); | |
echo mysql_error(); | |
?> | |
<html> | |
<body> | |
<h2>Project Category Edited Successfully</h2> | |
<a href="project_categories.php">Return to Project Category Associations</a> | |
</body> | |
<html> | |
<? | |
} | |
else | |
{ | |
$query = "Select * from project_categories where category_id = $cat_id AND project_id = '$prj_id'"; | |
$result = mysql_query($query); | |
echo mysql_error(); | |
$dbiterator = mysql_fetch_array($result); | |
$shortname = $dbiterator["description"]; | |
$description = $dbiterator["long_description"]; | |
?> | |
<html> | |
<body> | |
<h2>Edit a Project Category Association</h2><br/> | |
<form action="edit_prj_category.php" method="POST"> | |
<table> | |
<tr> | |
<td>Project ID :</td> | |
<td><?=$prj_id;?></td> | |
</tr> | |
<tr> | |
<td>Category ID :</td> | |
<td><input name="cat_id" value="<?=$cat_id;?>" type="text"></td> | |
</tr> | |
<tr> | |
<td>Short Description:</td> | |
<td><input name="shortname" value="<?=$shortname;?>" type="text"></td> | |
</tr> | |
<tr> | |
<td>Long Description :</td> | |
<td> | |
<textarea name="description" rows="10" cols="50" wrap="off"><?=$description;?></textarea> | |
</td> | |
</tr> | |
<tr> | |
<td><input type="hidden" name="prj_id" value="<?=$prj_id;?>"></td> | |
<td><input type="submit" name="submit" value="Edit Project Category"/></td> | |
</tr> | |
</table> | |
</form> | |
</body> | |
<html> | |
<? } ?> |