Welcome Guest, Not a member yet? Register   Sign In
casecade dropdown
#1

[eluser]Unknown[/eluser]
hai everybody

I want to load a selectbox based on another selectbox selected value. For example load state selectbox based on selected country. can anyone help me, its is very urgent for me.



thanks before
#2

[eluser]AlexPOWER[/eluser]
do you use dynamic or static select box?
#3

[eluser]Unknown[/eluser]
Thanks for the reply.

I use dynamic selectbox. For that i used this code,


<select id="country">ajax->remote_function(array('update' => 'state', 'url' => "/test/index.php/test/testfun/"); ?&gt;">
<option value="1">India</option>
<option value="2">Australia</option>
</select>

<select id="state">

</select>



This function work properly, but i dont know how to get and pass the country id to testfun function.
#4

[eluser]AlexPOWER[/eluser]
Ok,
try with this.

Code:
function reload(form){
var val=form.cuntry.options[form.cuntry.options.selectedIndex].value;
self.location=index.php?cuntry=' + val;
}
and just add input function like...
Code:
&lt;?
@$cuntry = $_GET['cuntry'];

if(strlen($cuntry) > 0 and !is_numeric($cuntry))
{
    echo "Data Error 2";
    exit;
}
?&gt;

That may help! 8-/

So you have $cuntry as a number,and you can manipulate with it!




Theme © iAndrew 2016 - Forum software by © MyBB