New general function for form confirmation pages.
authorSam White <webmaster@ycra.org.uk>
Sat, 20 Nov 2021 16:44:08 +0000 (16:44 +0000)
committerSam White <webmaster@ycra.org.uk>
Sat, 20 Nov 2021 16:44:08 +0000 (16:44 +0000)
public_html/includes/forms.php [new file with mode: 0644]

diff --git a/public_html/includes/forms.php b/public_html/includes/forms.php
new file mode 100644 (file)
index 0000000..19e37a1
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+require_once('includes/utils.php');
+require_once('includes/fields.php');
+
+function confirm_sent_form_data($data, $keys) {?>
+  <form method="post" action="">
+    <table style="width: max-content;"><?php
+      foreach ($keys as $key) {
+        if (!empty($data[$key])) {?>
+          <tr>
+            <th><?php esc(key_to_human_text($key));?>:</th>
+            <td><?php esc($data[$key]);?></td>
+          </tr><?php
+          hidden_field($key, $data[$key]);
+        }
+      }?>
+    </table>
+    <input type="submit" name="back" value="Back" />
+    <input type="submit" name="confirm" value="Confirm details are correct" />
+  </form><?php
+}