Hi
I’ll try to explain this the best way I can. I have a countrylist (multilingual, and works fine), and I would like to see another one being populated based on the first selection. However, I don’t really need to get that second part from a DB since those values will stay the same. I have tried it with javascript but that did’t really work. The code for the first selectbox is:
<?php
$options = array('' => 'Alle Landen', 'Germany' => $_LANG['C_GERMANY'], 'Andorra' => $_LANG['C_ANDORRA'], 'England' => $_LANG['C_ENGLAND'], 'Austria' => $_LANG['C_AUSTRIA'], 'Belgium' => $_LANG['C_BELGIUM'], 'Scotland' => $_LANG['C_SCOTLAND'], 'Spain' => $_LANG['C_SPAIN'], 'France' => $_LANG['C_FRANCE'], 'Greece' => $_LANG['C_GREECE'], 'Canary' => $_LANG['C_CANARY'], 'Ireland' => $_LANG['C_IRELAND'], 'NorthIreland' => $_LANG['C_NIRELAND'], 'Italy' => $_LANG['C_ITALY'], 'Madeira' => $_LANG['C_MADEIRA'], 'Malta' => $_LANG['C_MALTA'], 'Netherlands' => $_LANG['C_NETHERLANDS'], 'Wales' => $_LANG['C_WALES'], 'Portugal' => $_LANG['C_PORTUGAL'], 'Switzerland' => $_LANG['C_SWITZERLAND'], 'Bulgaria' => $_LANG['C_BULGARIA'], 'Croatia' => $_LANG['C_CROATIA'], 'Czech' => $_LANG['C_CZECH']);?>
<div align="center">LAND:<br>
<select name="search_country" class="style1">
<?php
foreach ( $options as $key => $value)
{
$selected = '';
if(isset($_GET['search_country']) && $_GET['search_country'] == $key)
{
$selected = ' selected ';
}
echo '<option value="' . $key . '" ' . $selected .'>' . $value . '</option>';
}
?>
So basically, if somone selects Netherlands it should display the provinces of the netherlands from a preset [hardcoded] list. Everything I tried so far results in either no list at all, code errors or a full list with every province of every country. Can I add an ‘if’ statement somehow that checks value in box one and based on that display anything that matches the if statement? If so, any pointers in where to start (besides the manual)?
What is the best way to achieve the above (and please remember I’m a beginner).
thanks once again!