Commit 7a04d7d3743a9d0e028f0905631159fc2cbb6320

Authored by Alex Savenko
1 parent 6ad839b6

submit button check

src/app/backend/controllers/CustomersController.php
@@ -18,6 +18,7 @@ class CustomersController extends \Phalcon\Mvc\Controller @@ -18,6 +18,7 @@ class CustomersController extends \Phalcon\Mvc\Controller
18 18
19 $search_name = $this->request->getPost('search_name', 'string', NULL); 19 $search_name = $this->request->getPost('search_name', 'string', NULL);
20 $search_phone = $this->request->getPost('search_phone', 'string', NULL); 20 $search_phone = $this->request->getPost('search_phone', 'string', NULL);
  21 + $search_submit = $this->request->getPost('search_submit', 'string', NULL);
21 $this->session->set('search_name', $search_name); 22 $this->session->set('search_name', $search_name);
22 $this->session->set('search_phone', $search_phone); 23 $this->session->set('search_phone', $search_phone);
23 if (!empty($search_name) && isset($search_phone)) { 24 if (!empty($search_name) && isset($search_phone)) {
@@ -32,7 +33,7 @@ class CustomersController extends \Phalcon\Mvc\Controller @@ -32,7 +33,7 @@ class CustomersController extends \Phalcon\Mvc\Controller
32 $data = $this->models->getCustomers()->getDataByPhone($search_phone); 33 $data = $this->models->getCustomers()->getDataByPhone($search_phone);
33 $total = 1; 34 $total = 1;
34 } 35 }
35 - else { 36 + elseif (isset($search_submit)) {
36 $this->flash->notice("Параметры поиска не указаны"); 37 $this->flash->notice("Параметры поиска не указаны");
37 $data = $this->models->getCustomers()->getAllData($page); 38 $data = $this->models->getCustomers()->getAllData($page);
38 $total = $this->models->getCustomers()->countData(); 39 $total = $this->models->getCustomers()->countData();
src/app/backend/views/customers/index.php
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 <form method="post" action="" style="margin:10px;"> 15 <form method="post" action="" style="margin:10px;">
16 <input type="text" name="search_name" placeholder="поиск по имени" value="<?= $this->session->get('search_name'); ?>" /> 16 <input type="text" name="search_name" placeholder="поиск по имени" value="<?= $this->session->get('search_name'); ?>" />
17 <input type="text" name="search_phone" placeholder="поиск по телефону" value="<?= $this->session->get('search_phone'); ?>" /> 17 <input type="text" name="search_phone" placeholder="поиск по телефону" value="<?= $this->session->get('search_phone'); ?>" />
18 - <input type="submit" value="Поиск" /> 18 + <input type="submit" name="search_submit" value="Поиск" />
19 </form> 19 </form>
20 <div class="table_pages_wrapper"> 20 <div class="table_pages_wrapper">
21 21