Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Dwa obowiązkowe checkboxy
phpkm
post
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 12.09.2010

Ostrzeżenie: (0%)
-----


Witam

Mam obecnie na stronie obowiązkowy jeden checkbox, chciałbym dodać drugi, tak aby możliwe było przejście do kolejnej strony jedynie po zaznaczeniu obydwu.

Dodałem na stronie drugi chceckbox i teraz wygląda to tak:
  1. <input id="tac" type="checkbox" name="tac" value="1" /> akcept 1
  2. <input id="tac2" type="checkbox" name="tac2" value="1" /> akcept 2


W kontrolerze wygląda to tak:
  1. <?php
  2. class CartController extends Zend_Controller_Action
  3. {
  4.  
  5. public function regulationsAction() {
  6. if (!$this->_request->isPost())
  7. {
  8. return $this->_helper->_redirector->gotoRoute(array(), 'cart');
  9. }
  10.  
  11. $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger');
  12. $cart = Zend_Registry::get('cart');
  13.  
  14. if($this->_getParam('tac') == 1) {
  15. $cart->tac = true;
  16. return $this->_helper->_redirector->gotoRoute(array(), 'delivery');
  17. }
  18. elseif($this->_getParam('tac') == 0) {
  19. $cart->tac = false;
  20. $this->_flashMessenger->addMessage(array(0, 'Zaakceptuj accept 1.'));
  21. return $this->_helper->_redirector->gotoRoute(array(), 'cart');
  22. }
  23. }
  24. ...


Wie ktoś co należy zmienić i gdzie ?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 18:54