feat/send-mail-to-member #81
@ -1,9 +1,13 @@
|
|||||||
{% from "macros/form.njk" import label, field, select, option, textarea, checkboxes, button %}
|
{% from "macros/form.njk" import label, field, select, option, textarea, checkboxes, button, hidden_field %}
|
||||||
|
|
||||||
<section class="[ form-container ]">
|
<section class="[ form-container ]">
|
||||||
<svg aria-hidden="true" viewBox="0 0 1440 131" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill="#fff" d="M0 0h1440v131H0z"/><path d="M0 4.643l40-2.326c40-2.5 120-6.888 200 11.67 80 18.735 160 60.854 240 74.894 80 14.04 160 0 240-16.365 80-16.54 160-34.968 240-28.08 80 7.152 160 39.619 240 39.75 80-.131 160-32.598 200-49.139l40-16.365V131H0V4.643z" fill="#D6F253"/></svg>
|
{% if not contactMember %}
|
||||||
|
<svg aria-hidden="true" viewBox="0 0 1440 131" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill="#fff" d="M0 0h1440v131H0z"/><path d="M0 4.643l40-2.326c40-2.5 120-6.888 200 11.67 80 18.735 160 60.854 240 74.894 80 14.04 160 0 240-16.365 80-16.54 160-34.968 240-28.08 80 7.152 160 39.619 240 39.75 80-.131 160-32.598 200-49.139l40-16.365V131H0V4.643z" fill="#D6F253"/></svg>
|
||||||
|
{% endif %}
|
||||||
<div class="[ inner-wrapper ]">
|
<div class="[ inner-wrapper ]">
|
||||||
<h2 id="contact-form" class="[ contact-heading ]">Nous contacter</h2>
|
{% if not contactMember %}
|
||||||
|
<h2 id="contact-form" class="[ contact-heading ]">Nous contacter</h2>
|
||||||
|
{% endif %}
|
||||||
<form name="contact" method="POST" action="/form/contact-form-handler.php">
|
<form name="contact" method="POST" action="/form/contact-form-handler.php">
|
||||||
<ol class="[ field-list ]">
|
<ol class="[ field-list ]">
|
||||||
<li class="[ field-list__field-group ]">
|
<li class="[ field-list__field-group ]">
|
||||||
@ -16,20 +20,31 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="[ field-list__field-group ] [ full-width ]">
|
<li class="[ field-list__field-group ] [ full-width ]">
|
||||||
{{ label("Je vous contacte pour :", "select") }}
|
{{ label("Je vous contacte pour :", "select") }}
|
||||||
{{ select( "select", [
|
{% if contactMember %}
|
||||||
{label: "Obtenir un rendez-vous (décrivez votre projet en quelques lignes)", value: "option 1"},
|
{{ select( "select", [
|
||||||
{label: "Obtenir des précisions sur le statut d’entrepreneur salarié", value: "option 2"},
|
{label: "Obtenir un rendez-vous (décrivez votre projet en quelques lignes)", value: "option 1"},
|
||||||
{label: "Proposer une mission à un coopérateur", value: "option 3"},
|
{label: "Proposer une mission à un coopérateur", value: "option 3"}
|
||||||
{label: "Proposer un partenariat", value: "option 4"}
|
], { required: true, options_before: [""], options_after: ["Autre demande"] } ) }}
|
||||||
], { required: true, options_before: [""], options_after: ["Autre demande"] } ) }}
|
{% else %}
|
||||||
|
{{ select( "select", [
|
||||||
|
{label: "Obtenir un rendez-vous (décrivez votre projet en quelques lignes)", value: "option 1"},
|
||||||
|
{label: "Obtenir des précisions sur le statut d’entrepreneur salarié", value: "option 2"},
|
||||||
|
{label: "Proposer une mission à un coopérateur", value: "option 3"},
|
||||||
|
{label: "Proposer un partenariat", value: "option 4"}
|
||||||
|
], { required: true, options_before: [""], options_after: ["Autre demande"] } ) }}
|
||||||
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
<li class="[ field-list__field-group ] [ full-width ]">
|
<li class="[ field-list__field-group ] [ full-width ]">
|
||||||
{{ label("Votre message", "message") }}
|
{{ label("Votre message", "message") }}
|
||||||
{{ textarea( "message", { required: true, autocapitalize: "sentences", spellcheck: "true" } ) }}
|
{{ textarea( "message", { required: true, autocapitalize: "sentences", spellcheck: "true" } ) }}
|
||||||
</li>
|
</li>
|
||||||
<li class="[ field-list__field-group ] [ full-width ]">
|
{% if contactMember %}
|
||||||
{{ checkboxes("", "subscribe", [ "Je souhaite être tenu au courant de l’actualité Astrolabe"], { description: "" } ) }}
|
{{ hidden_field('subscribe', '') }}
|
||||||
</li>
|
{% else %}
|
||||||
|
<li class="[ field-list__field-group ] [ full-width ]">
|
||||||
|
{{ checkboxes("", "subscribe", [ "Je souhaite être tenu au courant de l’actualité Astrolabe"], { description: "" } ) }}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
<!-- H o n e y p o t -->
|
<!-- H o n e y p o t -->
|
||||||
<li aria-hidden="true">
|
<li aria-hidden="true">
|
||||||
<label class="ohnohoney" for="name"></label>
|
<label class="ohnohoney" for="name"></label>
|
||||||
@ -40,6 +55,9 @@
|
|||||||
<input tabindex="-1" class="ohnohoney" autocomplete="off" type="email" id="email" name="email" placeholder="Your e-mail here">
|
<input tabindex="-1" class="ohnohoney" autocomplete="off" type="email" id="email" name="email" placeholder="Your e-mail here">
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
{% if contactMember %}
|
||||||
|
{{ hidden_field('contactTo', contactMember) }}
|
||||||
|
{% endif %}
|
||||||
{{ button("Envoyer") }}
|
{{ button("Envoyer") }}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,13 +15,11 @@ $domainFromMyEmail = (
|
|||||||
: $myEmailSplitted[1];
|
: $myEmailSplitted[1];
|
||||||
|
|
||||||
$wantedContact = filter_input(INPUT_POST, 'contactTo', FILTER_VALIDATE_EMAIL);
|
$wantedContact = filter_input(INPUT_POST, 'contactTo', FILTER_VALIDATE_EMAIL);
|
||||||
if (
|
$wantedContact = (
|
||||||
empty($wantedContact)
|
empty($wantedContact)
|
||||||
|| empty($domainFromMyEmail)
|
|| empty($domainFromMyEmail)
|
||||||
|| substr($wantedContact, -strlen($domainFromMyEmail)) != $domainFromMyEmail
|
|| substr($wantedContact, -strlen($domainFromMyEmail)) != $domainFromMyEmail
|
||||||
) {
|
) ? $myEmail : "$wantedContact@$domainFromMyEmail" ;
|
||||||
$wantedContact = $myEmail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(empty($_POST['namezzz']) || empty($_POST['emailzzz']) || empty($_POST['message'])) {
|
if(empty($_POST['namezzz']) || empty($_POST['emailzzz']) || empty($_POST['message'])) {
|
||||||
$errors .= "\n Error: all fields are required";
|
$errors .= "\n Error: all fields are required";
|
||||||
|
Loading…
Reference in New Issue
Block a user