Hi,
I have 3 dropdownlist. All the data comes from the DB from three seperate tables.
There is one table which has the link between these three values.
The problem is when I open my page I see the selected value from the DB in the dropdownlist, but I cannot change the value. This is my problem.
Here is the code. I put it in a function.
The purpose is to select clients in the first dropdownlist, then get the selected value from the database which belongs to the project in the second dropdownlist. After selecting a project get the roles in the third dropdownlist.
Filling the dropdownlist from the database is not the problem. When I want to change one of these values from the database through the dropdownlist, the value cannot be changed. It stays on the value from the database. It only should change the value client side, not in the database.
// Get existing klant from db at selected year and week
$sqlSearch = "SELECT klant_id FROM tijden where jaar = $jaar and week = $week LIMIT $i, 1";
$resultSearch = mysql_query($sqlSearch);
$numberSearch = mysql_num_rows($resultSearch);
//echo $numberSearch;
$klant = mysql_fetch_row($resultSearch);
echo $klant[0];
$sql = "SELECT * FROM klanten";
$result = mysql_query($sql)
or die('Fout bij ophalen omschrijvingen');
?>
<TD>
<?php
$klantenR = "";
if (isset($_REQUEST["mySelectKlanten"."".$i])) {
if($klant[0]) {
$klantenR = $klant[0];
} else){
$klantenR = $_REQUEST["mySelectKlanten"."".$i];
}
}
?>
<!-- submit page to itself -->
<select name = "<?php echo "mySelectKlanten"."".$i; ?>"
onchange="document.myForm.action = 'uren.php'; document.myForm.submit();">
<option value="">--- Select ---</option>
<?php
while ($line = mysql_fetch_assoc($result)) {
?>
<option value = "<?php echo trim($line['klant_id']); ?> "
<?php
if(trim($klantenR) == trim($line['klant_id'])) {
echo "selected='selected'";
}
?>>
<?php echo $line['bedrijfsnaam'];?>
</option>
<?php
}
?>
</select>
</TD>
<?php
}