Вот код контроллера:
public function action_product() {
$id = (int) Request::initial()->param('id');
$product = ORM::factory('product', $id);
$content = View::factory('prodView')
->bind('product', $product);
$this->template->title = $product->title;
$this->template->content = $content;
if(isset($_POST['Submit'])) {
$clientName = Arr::get($_POST, 'Name', '');
$clientPhone = Arr::get($_POST, 'Phone', '');
$clientAdress = Arr::get($_POST, 'Adress', '');
$orderNumber = Arr::get($_POST, 'Number', '');
$_POST = array(
'name' => $product->name,
'number' => $orderNumber,
'url' => $product->url,
'client_name' => $clientName,
'client_phone' => $clientPhone,
'client_adress' => $clientAdress
);
ORM::factory('order')
->values($_POST)
->save();
Controller::redirect('main/ordered');
}
Пробовал так:
if(isset($clientName)) {
ORM::factory('order')
->values($_POST)
->save();
}
else {
$error = TRUE;
}
И в вид вставлял:
<?php if(isset($error)) { ?>
<?php echo 'error'; ?>
<?php } ?>
Так не работает..