2
I downloaded the codes from a page on https://html5up.net/ to use as a temporary page while the site of an event I organize is not ready. The page has only one field where the person puts the email and click send.
I need that when she clicks the button Send, the email that she typed is sent to me via email so I can register it.
In the head
of HTML there’s a line lynching the index.html to page with the JS (down the line):
head of index.html
<link rel="stylesheet" href="assets/css/main.css" />
index.html
<!-- Signup Form -->
<form id="signup-form" method="post" action="#">
<input type="email" name="email" id="email" placeholder="E-mail" />
<input type="submit" value="Enviar" />
</form>
main.js
// Signup Form.
(function() {
// Vars.
var $form = document.querySelectorAll('#signup-form')[0],
$submit = document.querySelectorAll('#signup-form input[type="submit"]')[0],
$message;
// Bail if addEventListener isn't supported.
if (!('addEventListener' in $form))
return;
// Message.
$message = document.createElement('span');
$message.classList.add('message');
$form.appendChild($message);
$message._show = function(type, text) {
$message.innerHTML = text;
$message.classList.add(type);
$message.classList.add('visible');
window.setTimeout(function() {
$message._hide();
}, 3000);
};
$message._hide = function() {
$message.classList.remove('visible');
};
// Events.
// Note: If you're *not* using AJAX, get rid of this event listener.
$form.addEventListener('submit', function(event) {
event.stopPropagation();
event.preventDefault();
// Hide message.
$message._hide();
// Disable submit.
$submit.disabled = true;
// Process form.
// Note: Doesn't actually do anything yet (other than report back with a "thank you"),
// but there's enough here to piece together a working AJAX submission call that does.
window.setTimeout(function() {
// Reset form.
$form.reset();
// Enable submit.
$submit.disabled = false;
// Show message.
$message._show('success', 'Obrigado! Nos vemos em breve ; )');
//$message._show('failure', 'Something went wrong. Please try again.');
}, 750);
});
})();
If your server supports PHP you can use Phpmailer https://answall.com/questions/251300/formul%C3%A1rio-html-e-php/251473#251473
– user60252
Do you just want the email to sign up for an email marketing? If it is, just use the code directly from the platform. Tell us what you really need to send the code ready, or give us a more graphic solution possible.
– Mr Genesis
@Genesisr. I only need to receive the e-mail to register on the Mkt email platform yes, only I didn’t want to lose the layout of the site. When someone clicks to send a "thank you" message appears, for example. I want it to stay.
– user99005
Which server language you use, php?
– Sam
@Private Yes, it’s php!
– user99005