Answer the question
In order to leave comments, you need to log in
Symfony double post method?
There is a ready-made code for working with payment, after payment a form pops up for filling in the data of full name, mail, phone.
When filling in this data, everything falls into the CMS (self-written) and doubles. In addition, the data does not fall into its cells
Here is the code
public function actSupportSave()
{
$post = $_POST;
$amount = isset($post['amount']) ? intval(str_replace(' ', '', $post['amount'])) : 0;
$currency = isset($post['currency']) ? $post['currency'] : 0;
$project = isset($post['project']) ? $post['project'] : 0;
$array = [];
$array['name'] = 'Поддержка фонда, сумма '.$amount.', дата '.date('d.m.Y, H:i');
$array['class_id'] = 43;
$array['parent_id'] = 877;
$array['project'] = $project;
$this->models['orm']->addObject($array, $array);
$email = $this->models['orm']->getObject(5, true);
$host = $this->request->server->get('HTTP_HOST');
$this->mailer->setTo($email->field('value'));
$this->mailer->setSubject($array['name']);
$this->mailer->setContent('<html>'
.'Здравствуйте <b>Администратор</b>!<br />'
.'Только что пользователь сайта <a href="http://'.$host.'" target="_blank">'.$host.'</a> поддержал проект.<br /><br />'
.'ФИО: <b>'.( !empty($post['fio']) ? $post['fio'] : '-') .'</b><br />'
.'Email: <b>'.( !empty($post['email']) ? $post['email'] : '-') .'</b><br />'
.'Телефон: <b>'.( !empty($post['phone']) ? $post['phone'] : '-') .'</b><br />'
.'Сумма: <b>'.$amount.' ('.$currency.')</b><br />'
.'Проект: <b>'.$project.'</b><br />'
.'<br />'
.'<br />'
.'С уважением, система сайта <a href="http://'.$host.'" target="_blank">'.$host.'</a>'
.'</html>');
$this->mailer->send();
// Сохранить данные в базу
// Отправить почту с данными
return json_encode(['success' => true, 'post' => $post]);
}
public function actSupportSave()
{
$post = $_POST;
$amount = isset($post['amount']) ? intval(str_replace(' ', '', $post['amount'])) : 0;
$currency = isset($post['currency']) ? $post['currency'] : 0;
$project = isset($post['project']) ? $post['project'] : 0;
$array = [];
$array['name'] = 'Поддержка фонда, сумма '.$amount.', дата '.date('d.m.Y, H:i');
$array['class_id'] = 43;
$array['parent_id'] = 877;
$array['project'] = $project;
$array['fio'] = $post['fio'];
$array['email'] = $post['email'];
$array['phone'] = $post['phone'];
$this->models['orm']->addObject($array, $array);
$email = $this->models['orm']->getObject(5, true);
$host = $this->request->server->get('HTTP_HOST');
$this->mailer->setTo($email->field('value'));
$this->mailer->setSubject($array['name']);
$this->mailer->setContent('<html>'
.'Здравствуйте <b>Администратор</b>!<br />'
.'Только что пользователь сайта <a href="http://'.$host.'" target="_blank">'.$host.'</a> поддержал проект.<br /><br />'
.'ФИО: <b>'.( !empty($post['fio']) ? $post['fio'] : '-') .'</b><br />'
.'Email: <b>'.( !empty($post['email']) ? $post['email'] : '-') .'</b><br />'
.'Телефон: <b>'.( !empty($post['phone']) ? $post['phone'] : '-') .'</b><br />'
.'Сумма: <b>'.$amount.'</b><br />'
.'Проект: <b>'.$project.'</b><br />'
.'<br />'
.'<br />'
.'С уважением, система сайта <a href="http://'.$host.'" target="_blank">'.$host.'</a>'
.'</html>');
$this->mailer->send();
// Сохранить данные в базу
// Отправить почту с данными
return json_encode(['success' => true, 'post' => $post]);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question