You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.2 KiB
87 lines
2.2 KiB
2 years ago
|
<?php
|
||
|
include("header.php");
|
||
|
|
||
|
// display only if admin
|
||
|
if($_SESSION['suser_level'] >= 2) {
|
||
|
|
||
|
// check for submit
|
||
|
if ($_SERVER['REQUEST_METHOD']=="POST" ) {
|
||
|
$location_id = $_POST['location_id'];
|
||
|
$location_name = $_POST['location_name'];
|
||
|
$parent = $_POST['parent'];
|
||
|
$location_info = $_POST['location_info'];
|
||
|
mysql_query("UPDATE location SET location_name='$location_name', parent='$parent', location_info='$location_info' WHERE location_id='$location_id'") or die(mysql_error());
|
||
|
|
||
|
header_location("locationview.php?location_id=" . $location_id);
|
||
|
}
|
||
|
|
||
|
$location_id = $_GET['location_id'];
|
||
|
|
||
|
// get current information
|
||
|
$result = mysql_query("SELECT location_name, parent, location_info FROM location WHERE location_id='$location_id'");
|
||
|
while ($row = mysql_fetch_object($result)) {
|
||
|
$location_name = $row->location_name;
|
||
|
$location_info = $row->location_info;
|
||
|
$parent = $row->parent;
|
||
|
}
|
||
|
?>
|
||
|
|
||
|
<form method="POST" action="locationedit.php">
|
||
|
<input type="hidden" name="location_id" value="<?php echo $location_id; ?>">
|
||
|
<table border="0">
|
||
|
<tr>
|
||
|
<td colspan="2">
|
||
|
<b>Edit location:</b><br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
Location name:
|
||
|
</td>
|
||
|
<td>
|
||
|
<input type="text" name="location_name" value="<?php echo $location_name; ?>">
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
Parent:
|
||
|
</td>
|
||
|
<td>
|
||
|
<select name="parent">
|
||
|
<option value="0">(none)</option>
|
||
|
<?php
|
||
|
$result = mysql_query("SELECT location_name, location_id FROM location ORDER BY location_name");
|
||
|
while ($row = mysql_fetch_object($result)) {
|
||
|
if ($row->location_id==$parent) {
|
||
|
$selected = 'selected';
|
||
|
} else {
|
||
|
$selected = '';
|
||
|
}
|
||
|
echo '<option value="' . $row->location_id . '" ' . $selected . '>' . $row->location_name . '</option>';
|
||
|
}
|
||
|
?>
|
||
|
</select>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
Location info:
|
||
|
</td>
|
||
|
<td>
|
||
|
<textarea name="location_info"><?php echo $location_info; ?></textarea>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td colspan="2" align="right">
|
||
|
<input type="submit" value="Submit"><input type="reset" value="Reset">
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</form>
|
||
|
|
||
|
<?php
|
||
|
// end display only if admin
|
||
|
}
|
||
|
|
||
|
include("footer.php");
|
||
|
?>
|