Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Message: Undefined variable: option
--armind--
post
Post #1





Goście







Problem zaczyna się od linijek: if ($this->input->post('add'))
Da sie jakos te 2 kody połaczyc....?


  1. public function hitlist()
  2. {
  3. if ($this->uri->segment(3) == 'vote')
  4. {
  5. $id = $this->uri->segment(4);
  6. $this->load->model('Hitlist_model');
  7. $this->Hitlist_model->vote($id);
  8. $this->session->set_flashdata('error', 'Głos oddano.');
  9. redirect('script/hitlist');
  10. }
  11. else
  12. {
  13.  
  14. $this->load->model('Hitlist_model');
  15. $data['list'] = $this->Hitlist_model->getList();
  16. $this->load->view('script/hitlist', $data);
  17. }
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. if ($this->input->post('add'))
  27. {
  28. $this->form_validation->set_rules('name', '', 'trim|required|xss_clean|callback__html2txt');
  29. if ($this->form_validation->run() == FALSE)
  30. {
  31. $this->session->set_flashdata('error', 'Nie podałeś nazwy utworu.');
  32. redirect('script/hitlist');
  33. }
  34. else
  35. {
  36. $data['name'] = $this->input->post('name');
  37. $data['add'] = 0;
  38. $data['date'] = time();
  39. $this->load->model('Hitlist_model');
  40. $this->Hitlist_model->addHitlist($data);
  41. $this->session->set_flashdata('error', 'Propozycja wysłana.');
  42. redirect('script/hitlist');
  43. }
  44. }
  45. else
  46. {
  47. $this->load->model('Hitlist_model');
  48. $option = $this->Hitlist_model->getOption();
  49. $data['option'] = $option[0]->option;
  50. $this->load->view('script/hitlist', $data);
  51. }
  52.  
  53.  
  54. }
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
b4rt3kk
post
Post #2





Grupa: Zarejestrowani
Postów: 1 933
Pomógł: 460
Dołączył: 2.04.2010
Skąd: Lublin

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


Komunikat mówi jasno: Message: Undefined variable: option. Przejrzyj kod i zobacz czy dla zmiennej option zostaje wcześniej przypisana jakaś watość zanim jej używasz.


--------------------
Jeśli pomogłem, kliknij proszę 'pomógł'. Dzięki.
Go to the top of the page
+Quote Post

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: 20.08.2025 - 11:50