Contact Form Example - lokothodida/DM_Matrix GitHub Wiki
This is a brief walkthrough on how to set up a basic feedback form. Visitors can submit queries that can then be viewed in the back-end of the site (via The Matrix tab in the table view).
Build a table with the following properties
- Name: contact
-
Fields:
- Name: title, Type: textlong
- Name: email, Type: email
- Name: date, Type: datetimelocal, Read Only: readonly, Visibility: Invisible in form
- Name: content, Type: bbcodeeditor
- Max Records: 0
<?php
if ($_SERVER['REQUEST_METHOD']=='POST') {
$success = $var->createRecord('contact', $_POST);
if ($success) echo '<p class="success">Success! Your message has been sent.</p>';
else echo '<p class="error">Error! Your message has not been sent. Try again later.</p>';
}
?>
<form method="post">
<?php $var->displayForm('contact'); ?>
<button>Submit Form</button>
</form>