Welcome Guest, Not a member yet? Register   Sign In
Help with categoris and subcategory
#1

[eluser]Dzemail[/eluser]
plase i need help

I need to make dropdown like this

Castrol
Castrol->Castrol model
Aral
Aral->Aral model

dropdown
Aral>Aral model
#2

[eluser]ojcarga[/eluser]
What code do you have? You are not providing any explanation and guess this doesn't help us to help you:

[quote author="Dzemail" date="1349727000"]
Castrol
Castrol->Castrol model
Aral
Aral->Aral model

dropdown
Aral>Aral model[/quote]
#3

[eluser]beeLoop[/eluser]
[quote author="Dzemail" date="1349727000"]plase i need help

I need to make dropdown like this

Castrol
Castrol->Castrol model
Aral
Aral->Aral model

dropdown
Aral>Aral model[/quote]


Please provide some more details.
Castrol and Aral , are they referring to model names?
#4

[eluser]Dzemail[/eluser]
the view i wont is :
Code:
<td>Parent Category:</td>
<td><select name="parent_id">
<option value="0"> --- None --- </option>
<option value="1">Desktops</option>
<option value="5">Desktops &gt; PC</option>
<option value="6">Desktops &gt; Mac</option>
<option value="8">Laptops &gt; Notebooks</option>
<option value="9">Laptops &gt; Notebooks &gt; Macs</option>
<option value="10">Laptops &gt; Notebooks &gt; Windows</option>
</select></td>

My code from model is

Code:
public function drop()
         {
           $qveri = $this->db->select('ID,ime')
           ->from('cate')
           ->get()->result();
          
           $podateke=array('' => '');
          
           foreach($qveri as $rows)
           {
            $podateke[$rows->ID] = $rows->ime;
            
           }
          
           return $podateke;
         }


Like this is my code the view dropdown what i need id up if u have some ideas please help

#5

[eluser]LuckyFella73[/eluser]
http://ellislab.com/codeigniter/user-gui...elper.html

Look at the section "dropdown" - you can pass a multidimensional array to the
dropdown helper. Looks like you want to achieve.
#6

[eluser]Dzemail[/eluser]
Yes but i cant do it beceause i need help
#7

[eluser]ojcarga[/eluser]
What other help do you need? or you meant "Yes but i cant do it because i need help (The completed code)" ??
#8

[eluser]Dzemail[/eluser]
This what I need
Code:
<td>Parent Category:</td>
<td><select name="parent_id">
<option value="0"> --- None --- </option>
<option value="1">Desktops</option>
<option value="5">Desktops > PC</option>
<option value="6">Desktops > Mac</option>
<option value="8">Laptops > Notebooks</option>
<option value="9">Laptops > Notebooks > Macs</option>
<option value="10">Laptops > Notebooks > Windows</option>
</select></td>

And my code is Model:
Code:
public function drop()
         {
           $qveri = $this->db->select('ID,ime')
           ->from('cate')
           ->get()->result();
          
           $podateke=array('' => '');
          
           foreach($qveri as $rows)
           {
            $podateke[$rows->ID] = $rows->ime;
            
           }
          
           return $podateke;
         }
MY Controller
Code:
class Welcome extends CI_Controller
{
    
  public function index()
  {
    $this->load->model('data');
           $data['neki']=$this->data->drop();
    $this->load->view('welcome_message',$data);
  }
}


My View :
Code:
<p>Category Option : &lt;?php echo form_dropdown('dr',$neki); ?&gt;</p>

thakns

have nice day




Theme © iAndrew 2016 - Forum software by © MyBB