Ich habe ein Formular mit einer Select Box.
Wenn jemand einen Wert aus der Select-Box auswählt, sollen automatisch drei Formular Felder (ziel.lat.,lon) mit Werten aus der Datenbank gefüllt werden.
Komme da mit dem Javascript nicht weiter.
Code:
<tr>
<th colspan=\"2\"> Geo-Tagging: </th>
</tr>
<tr> <td> </td> </tr>
<tr>
<td> Ausflugsziel: </td>
<td>
";
// Datenbank abgragen
$result = mysql_query( " SELECT * FROM ".ZIELE_TABLE." ORDER by ID " );
print" <Select size=\"1\" name=\"cat\" onChange=\"w1(this.value);\">
<Option value=\"\"> -- alle Anzeigen -- </option>";
while ($row = mysql_fetch_row($result)) {
if ($row[0] == $cat->id) {
print "<Option value=\"$row[0]";
print "\" selected>$row[1]</option>"; } else
{ print "<Option value=\"$row[0]\">$row[1]</option>"; }
}
print "</select>";
print"
</td>
</tr>
<tr>
<td>Ziel-ID: </td>
<td><input name='ziel' id='ziel' type='text' size='25' value='$photo_ziel'></input> </td>
</tr>
<tr>
<td>Lat: </td>
<td><input name='lat' type='text' id='lat' size='50' value='$photo_lat'></input></td>
</tr>
<tr>
<td>Lon: </td>
<td><input name='lon' type='text' id='lon' size='50' value='$photo_lon'></input> </td>
</tr>
Code:
<script language="JavaScript">
function w1(wahl) {
document.getElementById('wahl').appendChild(ziel);
}
</script>
Mfg Maffy