Skip to content

Commit

Permalink
email form post ssl: test 02, add to DB
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrturner committed Feb 27, 2024
1 parent ccf000e commit 5cb05a4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 43 deletions.
4 changes: 2 additions & 2 deletions site/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ function generateRelationsJson()
* all config options: https://getkirby.com/docs/reference/system/options
*/
return [
// 'debug' => true,
'debug' => false,
'debug' => true,
// 'debug' => false,
'panel' => [
'install' => true
],
Expand Down
72 changes: 31 additions & 41 deletions site/templates/z_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,42 @@

<section id="col3" class="form" style="max-width: 60ch;">

<?= kt($page->form()) ?>

<?php if ($success) : ?>
<div class="alert success">
<p><?= $success ?></p>
<form method="post" action="<?= $page->url() ?>">
<div class="honeypot" style="position: absolute; left: -9999px;">
<label for="website">Website <abbr title="required">*</abbr></label>
<input type="url" id="website" name="website" tabindex="-1">
</div>
<?php else : ?>
<?php if (isset($alert['error'])) : ?>
<div><?= $alert['error'] ?></div>
<?php endif ?>
<form method="post" action="<?= $page->url() ?>">
<div class="honeypot" style="position: absolute; left: -9999px;">
<label for="website">Website <abbr title="required">*</abbr></label>
<input type="url" id="website" name="website" tabindex="-1">
</div>
<div class="field-group">
<div class="field half">
<input type="text" id="name" name="name" value="<?= esc($data['name'] ?? '', 'attr') ?>" placeholder="Name">
<?= isset($alert['name']) ? '<span class="alert error">' . esc($alert['name']) . '</span>' : '' ?>
</div>
<div class="field half">
<input type="text" id="pronouns" name="pronouns" value="<?= esc($data['pronouns'] ?? '', 'attr') ?>" placeholder="Pronouns">
<?= isset($alert['pronouns']) ? '<span class="alert error">' . esc($alert['pronouns']) . '</span>' : '' ?>
</div>
<div class="field-group">
<div class="field half">
<input type="text" id="name" name="name" value="<?= esc($data['name'] ?? '', 'attr') ?>" placeholder="Name">
<?= isset($alert['name']) ? '<span class="alert error">' . esc($alert['name']) . '</span>' : '' ?>
</div>
<div class="field-group">
<div class="field half">
<input type="email" id="email" name="email" value="<?= esc($data['email'] ?? '', 'attr') ?>" placeholder="eMail">
<?= isset($alert['email']) ? '<span class="alert error">' . esc($alert['email']) . '</span>' : '' ?>
</div>
<div class="field half">
<input type="tel" id="phone" name="phone" value="<?= esc($data['phone'] ?? '', 'attr') ?>" placeholder="Phone">
<?= isset($alert['phone']) ? '<span class="alert error">' . esc($alert['phone']) . '</span>' : '' ?>
</div>
<div class="field half">
<input type="text" id="pronouns" name="pronouns" value="<?= esc($data['pronouns'] ?? '', 'attr') ?>" placeholder="Pronouns">
<?= isset($alert['pronouns']) ? '<span class="alert error">' . esc($alert['pronouns']) . '</span>' : '' ?>
</div>
<div class="field">
<textarea id="text" name="text" placeholder="Request" required><?= esc($data['text'] ?? '') ?></textarea>

<?= isset($alert['text']) ? '<span class="alert error">' . esc($alert['text']) . '</span>' : '' ?>
</div>
<div class="field-group">
<div class="field half">
<input type="email" id="email" name="email" value="<?= esc($data['email'] ?? '', 'attr') ?>" placeholder="eMail">
<?= isset($alert['email']) ? '<span class="alert error">' . esc($alert['email']) . '</span>' : '' ?>
</div>
<div>
<button class="button__link button__submit" type="submit">Get in Touch</button>
<!-- <input type="submit" name="submit" value="Get in Touch"> -->
<div class="field half">
<input type="tel" id="phone" name="phone" value="<?= esc($data['phone'] ?? '', 'attr') ?>" placeholder="Phone">
<?= isset($alert['phone']) ? '<span class="alert error">' . esc($alert['phone']) . '</span>' : '' ?>
</div>
</form>
<?php endif ?>
</div>
<div class="field">
<textarea id="text" name="text" placeholder="Request" required><?= esc($data['text'] ?? '') ?></textarea>

<?= isset($alert['text']) ? '<span class="alert error">' . esc($alert['text']) . '</span>' : '' ?>
</div>
<div>
<button class="button__link button__submit" type="submit">Get in Touch</button>
<!-- <input type="submit" name="submit" value="Get in Touch"> -->
</div>
</form>

</section>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
Expand Down

0 comments on commit 5cb05a4

Please sign in to comment.