JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
metaform e-mail updated for new template format
[wfpl.git] / encode.php
index cd1e0b4..6afcd41 100644 (file)
@@ -71,6 +71,15 @@ function enc_htmlbrtab($str) {
        return $str;
 }
 
+# Encode for output in html. Spaces converted to &nbsp; and \n to <br />
+#
+# Example: <option value="12">~foo.htmlbrnbsp~</option>
+function enc_htmlbrnbsp($str) {
+       $str = enc_htmlbr($str);
+       $str = str_replace(' ', '&nbsp;', $str);
+       return $str;
+}
+
 # Encode for output in html. Spaces converted to &nbsp;
 #
 # Example: <option value="12">~foo.htmlnbsp~</option>
@@ -293,7 +302,7 @@ function encode_options($selected, $options, $keys_from) {
                        $out .= ' selected="selected"';
                }
 
-               if($value !== $display) {
+               if($value !== $display || strpos($value, ' ') !== false) {
                        $out .= ' value="';
                        $out .= enc_attr($value);
                        $out .= '"';