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.
58 lines
1.4 KiB
58 lines
1.4 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'];
|
||
|
$subnet_id = $_POST['subnet_id'];
|
||
|
|
||
|
mysql_query("INSERT INTO subnetlocation (location_id, subnet_id) VALUE ('$location_id', '$subnet_id')") or die(mysql_error());
|
||
|
|
||
|
header("Location: subnet.php");
|
||
|
}
|
||
|
|
||
|
$subnet_id = $_GET['subnet_id'];
|
||
|
?>
|
||
|
|
||
|
<form method="POST" action="assignsubnettolocation.php">
|
||
|
<input type="hidden" name="subnet_id" value="<?php echo $subnet_id; ?>">
|
||
|
<table border="0">
|
||
|
<tr>
|
||
|
<td>
|
||
|
<b>Assign to:</b><br>
|
||
|
</td>
|
||
|
<td>
|
||
|
<select name="location_id">
|
||
|
|
||
|
<?php
|
||
|
function display_children($parent, $level) {
|
||
|
$result = mysql_query("SELECT location_id, location_name FROM location WHERE parent='$parent' ORDER BY location_name");
|
||
|
while ($row = mysql_fetch_object($result)) {
|
||
|
echo '<option value="' . $row->location_id . '">' . str_repeat(' ',$level) . $row->location_name . '</option>';
|
||
|
display_children($row->location_id, $level+1);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
display_children('',0);
|
||
|
?>
|
||
|
|
||
|
</select>
|
||
|
</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");
|
||
|
?>
|