Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

eoLithic

Newbie
  
  • Posts

    1
  • Joined

  • Last visited

eoLithic's Achievements

Newbie

Newbie (1/14)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. Привет. У меня возникла проблема. Я создал абсолютно новый шаблон в tempate/common. В этом шаблоне у меня хранится небольшая форма. Код шаблона: (да-да, во всем шаблоне у меня только этот код) <!doctype html> <div style="width: 723px;"> <form action="<?php echo $action; ?>" method="post"> Ваше имя: <input type="text" name="your_name"><br> Ваше e-mail: <input type="text" name="email"><br> <input type="submit" value="Заказать"> </form> </div> Я также создал контроллер для этой формы. Самая большая проблема для меня теперь - это переправить данные из формы в контроллер. Все что мне нужно, это лишь понять почему не приходят данные из формы. Код контроллера: <?php class ControllerCommonOrderForm extends Controller { public function index() { $this->document->setTitle($this->config->get('config_title')); $this->document->setDescription($this->config->get('config_meta_description')); $this->data['action'] = $this->url->link('common/orderForm'); $this->data['heading_title'] = $this->config->get('config_title'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/orderForm.tpl')) { $this->template = $this->config->get('config_template') . '/template/common/orderForm.tpl'; } else { $this->template = 'default/template/common/orderForm.tpl'; } $this->children = array( 'common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header' ); $this->response->setOutput($this->render()); /* Input data check */ $your_name = $this->config->get('your_name'); echo $your_name; $email = htmlspecialchars($_POST["email"]); /* Устанавливаем e-mail адресата */ $myemail = "[email protected]"; /* Создаем новую переменную, присвоив ей значение */ $message_to_myemail = "Здравствуйте! Вашей контактной формой было отправлено сообщение! Имя отправителя: $your_name E-mail: $email Конец"; /* Отправляем сообщение, используя mail() функцию */ $from = "From: $yourname <$email> \r\n Reply-To: $email \r\n"; mail($myemail, $message_to_myemail, $from); ?> <p>Ваше сообщение было успешно отправлено!</p> <p>На <a href="index.php">Главную >>></a></p> <?php /* Если при заполнении формы были допущены ошибки сработает следующий код: */ function check_input($data, $problem = "") { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myError) { ?> <html> <body> <p>Пожалуйста исправьте следующую ошибку:</p> <?php echo $myError; ?> </body> </html> <?php exit(); } } } ?> Я был бы очень благодарен тому, кто сумеет мне помочь. Спасибо за внимание.
Guest
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.