From 16cee87e522241cc356fc8b9a5f84fdd2c967a3e Mon Sep 17 00:00:00 2001
From: Sam White <webmaster@ycra.org.uk>
Date: Sat, 20 Nov 2021 16:42:59 +0000
Subject: [PATCH] Add separate function to print field attributes.

---
 public_html/includes/fields.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/public_html/includes/fields.php b/public_html/includes/fields.php
index 94e4059..685825e 100644
--- a/public_html/includes/fields.php
+++ b/public_html/includes/fields.php
@@ -11,13 +11,17 @@ function get_field_id($name) {
   return $name;
 }
 
+function print_attrs($attrs) {
+  foreach($attrs as $name=>$value) esc("$name='$value' ");
+}
+
 function general_bare_field($type, $values, $name, $attrs=[]) {
   $value = get_sent_field_value($values, $name);
   $id = get_field_id($name);?>
 
   <input type="<?php esc($type);?>" name="<?php esc($name);?>"
          id="<?php esc($id);?>" value="<?php esc($value);?>"<?php
-         foreach($attrs as $name=>$value) esc("$name=\"$value\" ");?>
+         print_attrs($attrs);?>
   /><?php
 }
 
-- 
2.25.1