基于这个解决方案,我为我的登陆页面创建了一个表单,我希望它可以工作,但我没有看到它在哪里失败,因为当你点击按钮。
PHP (form.php):
<?php
if (isset($_POST['submit'])) {
$to = "my@email.com";
$from = $email;
$first_name = $_POST['first_name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$subject = "Nuevo lead";
$message = $first_name . " " . $phone . " " . $email . " wrote the following:" . "\n\n";
$headers = "From:" . $from;
mail($to, $subject, $message, $headers);
echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
}
?>
HTML:
<form action="form.php" method="post" id="mc-embedded-subscribe-form"
name="mc-embedded-subscribe-form" class="validate">
<div id="mc_embed_signup_scroll">
<div class="flex-md-wrap">
<div class="mc-field-group flex-md-1">
<input type="text" value="" name="first_name" id="mce-FNAME" placeholder="Nombre" autocomplete='given-name'>
</div>
<div class="mc-field-group flex-md-1">
<input type="email" value="" name="email" id="mce-EMAIL" placeholder="Email" autocomplete='email'>
</div>
<div class="mc-field-group flex-md-1">
<input type="number" value="" name="phone" id="mce-PHONE" placeholder="Teléfono" autocomplete='tel'>
</div>
<div class="mc-field-group">
<input type="submit" value="ENVIAR" name="submit" id="mc-embedded-subscribe" class="btn btn--secondary">
</div>
</div>
</div>
</form>
有没有人知道发生了什么?
跃然一笑