Hi I am new to php and hoping someone can help me
I have a variable which contains a string like this:
[php]location_x=’[Country],county1,county2,county3,[Country2],county1,county2,county3,[Country3],county1,county2,county3’;[/php]
I can explode it and get select options ok like this- but I want to make it so country is a optgroup value rather than an option - I think I need to somehow make my array into a multideminsional one? Any help would be greatly apprecaited.
Cheers
[php]
$x = explode(’,’,$location_x);
for($i=0;$i<count($x);$i++)
{
if(trim($x[$i]))
{
echo ‘<option ‘;
if(trim($x[$i])==$location_id)
{
echo ’ selected=“selected” ‘;
}
echo ‘value="’. trim($x[$i]).’">’. trim($x[$i]).’’;
}
}
}
[/php]