diff --git a/webui/group-attribute-add.php b/webui/group-attribute-add.php
index 565f988538045b17e9ec155c1e3577dd35e7efb7..e05bb67e19ee2f6bad25f452980eaf1077c76b76 100644
--- a/webui/group-attribute-add.php
+++ b/webui/group-attribute-add.php
@@ -73,6 +73,7 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "add") {
 			</tr>
 			<tr>
 				<td colspan="2">
+					<input type="hidden" name="group_id" value="<?php echo $_POST['group_id']; ?>" />
 					<input type="submit" />
 				</td>
 			</tr>
@@ -96,7 +97,7 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "add") {
 	} else {
 		$stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}group_attributes (GroupID,Name,Operator,Value) VALUES (?,?,?,?)");
 		$res = $stmt->execute(array(
-			$attr_group_id,
+			$_POST['group_id'],
 			$_POST['attr_name'],
 			$_POST['attr_operator'],
 			$_POST['attr_value'],
diff --git a/webui/group-attributes.php b/webui/group-attributes.php
index eb13bd0f1aa512eb3b0197a028dd01c363189c63..d48ecf18c590cdd6640643a48e11cdd878506e3c 100644
--- a/webui/group-attributes.php
+++ b/webui/group-attributes.php
@@ -117,6 +117,9 @@ printHeader(array(
 <?php
 
 			}
+?>
+			<input type="hidden" name="group_id" value="<?php echo $_POST['group_id']; ?>" />
+<?php
 
 		} else {
 ?>