Hi there and @mzur,
I’ve setup a contact form with Uniform. The form is a snippet that I’m re-using in a template. The template is used to render different pages, like /financial-translation-services
or professional-translation-services
.
The code:
<?php
use Uniform\Form;
$form = new Form([
'email' => [
'rules' => ['required', 'email'],
'message' => 'Please enter a valid email address.',
],
'source' => [],
'target' => [],
'words' => [],
'page' => [],
]);
if (r::is('POST')) {
$form->emailAction([
'to' => 'mail@server.com',
'from' => 'bot@server.com',
'subject' => 'New opp from {email}',
]);
}
?>
I would like the form to send the page where this template was used, so we can learn which pages are converting the most. So, I’m using this in the body of the template:
<?php $form->data($key = 'page', $value = $page->uid()); ?>
By doing print_r($form->data());
it shows the value of the page
key. However, when I receive the form, the page
key is not sent. I get all the other values, except this one.
The full code is here: https://gist.github.com/rodrigogalindez/9a32e3d3dc0aab8ae5d099f0a7862887
What could be happening here? Thanks.