$attr = (!$name) ? "novalue" : "value='$name'"; ... is a reasonable alternative to ... if (!$name) $attr = "novalue"; else $attr = "value='$name'";
On the other hand ...
$len = ($len < BUFSIZE) ? $len : BUFSIZE; ... is probably better expressed as ... if ($len >= BUFSIZE) $len = BUFSIZE;