Welcome Guest, Not a member yet? Register   Sign In
How send mail the name country and not id?
#1

[eluser]amina[/eluser]
I have a depended select. I try to place in the view in option value rowz->name but if I place it does not take me go of cities too I try concant but it didn't work
My model:
Code:
function getCountry(){
return $this->db->query("SELECT * FROM  country order by name ASC");
    }
  
    function getCity($idcountry){
        
        $query="SELECT * FROM  cities  where id_country = ".$idcountry;
        
        $data=$this->db->query($query, $idcountry);
        
            if($data->num_rows()>0){
            $output="<option value=''>- Seleccione city-</option>";  
            foreach($data->result() as $item){
              $output.="<option value='".$item-&gt;id.'-'."$item->name'>".$item->name."</option>";  
            }
        }else{
           $output="not results";
        }
        echo $output;
    }

In the getCity I could concant the name city for send mail

My view:

Code:
<label for="f_country"class="label">Country</label>
<select name="country" id="country" class="input">
<option value='-1'></option>

&lt;?php foreach($dt_country->result() as $rowz): ?&gt;
<option value='&lt;?php echo $rowz-&gt;id;?&gt;'>&lt;?php echo $rowz-> name; ?&gt;</option>
&lt;?php endforeach; ?&gt;
</select>

<label for="f_city" class="label">City<span class="req">*</span></label>
&lt;?= form_error('city','<div class="error">', '</div>') ?&gt;
<select name="city" id="city" class="input"></select>
In my view I couldn't
Thanks


Messages In This Thread
How send mail the name country and not id? - by El Forum - 02-03-2012, 07:39 AM
How send mail the name country and not id? - by El Forum - 02-03-2012, 12:32 PM
How send mail the name country and not id? - by El Forum - 02-03-2012, 12:56 PM
How send mail the name country and not id? - by El Forum - 02-03-2012, 02:46 PM
How send mail the name country and not id? - by El Forum - 02-03-2012, 05:10 PM
How send mail the name country and not id? - by El Forum - 02-03-2012, 11:00 PM
How send mail the name country and not id? - by El Forum - 02-03-2012, 11:38 PM
How send mail the name country and not id? - by El Forum - 02-04-2012, 12:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB