On the site page several times the same module is displayed with the feedback form of the form

<form method="post"> <input type="text" name="phoneNumber"> <input type="submit" name="sendNumber" value="Отправить"> </form> 

When I fill in the phoneNumber field in one form and send the data, the email is duplicated as many times as the module on the page.

In the module folder in the helper.php file helper.php function to send is as follows

 public static function sendForm() { if(isset($_POST['sendNumber'])) { $jinput = JFactory::getApplication()->input; $mailer = JFactory::getMailer(); $mailer->addRecipient('myemail@gmail.com'); $phoneNumber = $jinput->get('phoneNumber', '', 'post'); $mailer->setSender('noreply@mydomain.com'); $mailer->setSubject('My subject'); $mailer->setBody($phoneNumber); $mailer->isHTML(true); $mailer->Send(); } } 

How to make the letter come only once?

  • in your form, I do not see a handler .... where do you send the data? or do you send it to default.php and call the function sendForm () from there? - Arsen
  • Is the module the same or copies of the module? - labris
  • What's the difference? - stckvrw
  • Correct me if I'm wrong - the handler is probably JS and processes these clicks as many times as there are forms on the page. - Alexey Shatrov
  • @stckvrw if you want to be helped, answer my first question - Arsen

0