$children ) { foreach( $children as $i => $child_dn ) { if( 0 == strcasecmp( $child_dn, $old_dn ) ) { $tree[$server_id][$parent_dn][$i] = $new_dn; } } } // Update the icon tree to reflect the change (remove the old DN and add the new one) $tree_icons[ $server_id ][ $new_dn ] = $tree_icons[ $server_id ][ $old_dn ]; unset( $tree_icons[ $server_id ][ $old_dn ] ); $_SESSION['tree'] = $tree; $_SESSION['tree_icons'] = $tree_icons; session_write_close(); $edit_url="edit.php?server_id=$server_id&dn=" . rawurlencode( "$new_rdn,$container" ); ?> Redirecting... click here if you're impatient.