par
Grégoire » 30 oct. 2012, 15:52
Bonjour
Il arrive souvent que les visteurs qui m'envois des messages avec une adresse email mal renseignée je cherche une
fonction pour comparer
2 adresses email dans le formulaire, déja il faudrait que je puisse rajouter dans la partie php le 2ème champ email voir ci-dessous. Dans la partie html c'est régler pour le champ email. Merci pour votre aide
/* Fields verifications */
if (empty($_POST['email']) OR empty($_POST['name']))
$error = $this->l('You must fill all fields.');
elseif (!Validate::isEmail($_POST['email']))
$error = $this->l('Your email is invalid.');
elseif (!Validate::isName($_POST['name']))
$error = $this->l('Your name is invalid.');
elseif (!Validate::isMessage($_POST['message']))
$error = $this->l('Your message contains invalid characters.');
else
{
/* Email generation */
$emailfrom = Tools::safeOutput($_POST['email']);
$namefrom = Tools::safeOutput($_POST['name']);
$subject = $this->l('Informations about').' '.$product->name;
$to = Configuration::get('EMAILSEND_ASKINFO');
$templateVars = array(
'{product}' => $product->name,
'{product_link}' => $productLink,
'{email}' => Tools::safeOutput($_POST['email']),
'{message}' => Tools::safeOutput($_POST['message']),
'{name}' => Tools::safeOutput($_POST['name'])
);
/* Email sending */
if (!Mail::Send(intval($cookie->id_lang), 'askinfoproduct', $subject, $templateVars, $to, NULL, $emailfrom, $namefrom, NULL, NULL, dirname(__FILE__).'/mails/'))
$error = $this->l('An error occurred during the process.');
else
$confirm = $this->l('An email has been sent successfully');
}
}
Bonjour
Il arrive souvent que les visteurs qui m'envois des messages avec une adresse email mal renseignée je cherche une [b]fonction[/b] pour comparer [b]2 adresses email dans le formulaire[/b], déja il faudrait que je puisse rajouter dans la partie php le 2ème champ email voir ci-dessous. Dans la partie html c'est régler pour le champ email. Merci pour votre aide
[php]/* Fields verifications */
if (empty($_POST['email']) OR empty($_POST['name']))
$error = $this->l('You must fill all fields.');
elseif (!Validate::isEmail($_POST['email']))
$error = $this->l('Your email is invalid.');
elseif (!Validate::isName($_POST['name']))
$error = $this->l('Your name is invalid.');
elseif (!Validate::isMessage($_POST['message']))
$error = $this->l('Your message contains invalid characters.');
else
{
/* Email generation */
$emailfrom = Tools::safeOutput($_POST['email']);
$namefrom = Tools::safeOutput($_POST['name']);
$subject = $this->l('Informations about').' '.$product->name;
$to = Configuration::get('EMAILSEND_ASKINFO');
$templateVars = array(
'{product}' => $product->name,
'{product_link}' => $productLink,
'{email}' => Tools::safeOutput($_POST['email']),
'{message}' => Tools::safeOutput($_POST['message']),
'{name}' => Tools::safeOutput($_POST['name'])
);
/* Email sending */
if (!Mail::Send(intval($cookie->id_lang), 'askinfoproduct', $subject, $templateVars, $to, NULL, $emailfrom, $namefrom, NULL, NULL, dirname(__FILE__).'/mails/'))
$error = $this->l('An error occurred during the process.');
else
$confirm = $this->l('An email has been sent successfully');
}
}[/php]