Welcome Guest, Not a member yet? Register   Sign In
[Help] with <select> auto reload
#1

[eluser]C_Line[/eluser]
i wan to register province and city

like this
//////////////////////////////////////////////////////////////////////////////////////
Code:
&lt;!--controller--&gt;
function daftar()
{
$this->load->view('header');
$this->load->view('frame_kiri');

$this->load->model('Query_barang','',TRUE);
$data['prop'] = $this->Query_barang->reg_prop();
$data['kota'] = $this->Query_barang->reg_kota();
$this->load->view('registrasi',$data);
}

&lt;!--model--&gt;
function reg_prop()
{
$prop = $this->db->query("select distinct(Propinsi) from tarif_kirim order by Propinsi ASC")->result();
return $prop;
}

function reg_kota()
{
$propi = $this->input->post('propinsi');
$kota = $this->db->query("select kota from tarif_kirim where Propinsi='$propi'")->result();
return $kot;
}

&lt;!--view--&gt;
<select name="propinsi" id="propinsi">
&lt;?php
foreach($prop as $kue)
{
?&gt;
<option value="&lt;?php echo $kue-&gt;Propinsi; ?&gt;">&lt;?php echo $kue->Propinsi; ?&gt;</option>
&lt;?php
}
?&gt;
</select>

Kota
<select name="kota_user">
&lt;?php
foreach($kota as $kues)
{
echo "<option value='". $kues-&gt;kota . "'>" . $kues->kota . "</option>";
}
?&gt;
</select>

[removed]
function come()
{
var el = document.getElementById('propinsi').value; // <- try to get value
document . write(el);
}
[removed]
//////////////////////////////////////////////////////////////////////////////////////

but it can't load, i dun wan use button
when i select propinsi, kota_user automatically load database and display it
help me,, thx


Messages In This Thread
[Help] with <select> auto reload - by El Forum - 07-04-2012, 06:35 PM
[Help] with <select> auto reload - by El Forum - 07-04-2012, 08:10 PM
[Help] with <select> auto reload - by El Forum - 07-04-2012, 08:41 PM
[Help] with <select> auto reload - by El Forum - 07-04-2012, 08:50 PM
[Help] with <select> auto reload - by El Forum - 07-04-2012, 09:14 PM
[Help] with <select> auto reload - by El Forum - 07-04-2012, 09:35 PM
[Help] with <select> auto reload - by El Forum - 07-04-2012, 09:59 PM
[Help] with <select> auto reload - by El Forum - 07-04-2012, 10:16 PM
[Help] with <select> auto reload - by El Forum - 07-04-2012, 11:21 PM
[Help] with <select> auto reload - by El Forum - 07-05-2012, 12:35 AM
[Help] with <select> auto reload - by El Forum - 07-05-2012, 12:38 AM
[Help] with <select> auto reload - by El Forum - 07-05-2012, 12:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB