diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index b4e5a8a0ec0..871821293b6 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2825,7 +2825,7 @@ class Form
/**
* Creates HTML units selector (code => label)
*
- * @param string $selected Preselected code ('km', 'm', 'l', 'p', ...)
+ * @param string $selected Preselected Unit ID
* @param string $htmlname Select name
* @param int $showempty Add a nempty line
* @return string HTML select
@@ -2846,13 +2846,13 @@ class Form
while($res = $this->db->fetch_object($resql))
{
- if ($selected == $res[0])
+ if ($selected == $res->rowid)
{
- $return.='';
+ $return.='';
}
else
{
- $return.='';
+ $return.='';
}
}
$return.='';