hente en værdi fra den tilhørende række
hejHar en select hvor et antal fodboldspillere bliver hentet ind i. Når man vælger en af spillerne fra drop down'en vil jeg gerne have hentet antal mål som den pågældende spiller har scoret. Har prøvet noget onchange og noget, men uden held....
//greasy
<?php
include ('functions.inc.php')
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Live opdatering af kamp</title>
</head>
<body>
<?php
if($opdater) {
connect();
$query = "UPDATE kampe SET maal1 = '$maal1', maal2 = '$maal2' where kamp_id=$kamp_id";
mysql_query($query);
}
?>
<?php
connect();
$result = mysql_query ("select * from kampe where kamp_id=$kamp_id");
?>
<form action=<?php echo $PHP_SELF ?>>
<table align='center' border='1'>
<!-- <tr><th>Kamp Nr.</th><th>hold1</th><th>hold2</th><th>mål hold 1</th><th>mål hold 2</th><th>Dato</th><th>lokal tid</th><th>kanal</th><th>tv-tid</th><th>res/status</th> -->
<?php
if ($myrow = mysql_fetch_array($result)) {
?>
<tr>
<td>kamp nr. <?php echo $myrow[kamp_id]?><input type=hidden name=kamp_id value=<?php echo $myrow[kamp_id]?>></td>
<td>mellem <?php echo $myrow[hold1]?> og</td>
<td> <?php echo $myrow[hold2]?></td>
<td>dato: <?php echo $myrow[dato]?></td>
<td><?php echo $myrow[lokaltid]?></td>
<td>kanal:<?php echo $myrow[kanal]?></td>
<td>tv-tid<?php echo $myrow[tvtid]?></td>
<td>staus:<?php echo $myrow[status]?></td>
</tr>
<tr>
<td></td><td><input type= tekst name= maal1 size=1 value=<?php echo $myrow[maal1]?> ></td>
<td><input type= tekst name= maal2 size=1 value=<?php echo $myrow[maal2]?> ></td>
</tr>
<tr><td>
<?php
$hold1=$myrow[hold1];
$hold2=$myrow[hold2];
}
echo"målscorer: <select name= maalscorer>";
$result = mysql_query ("select * from spillere where land='$hold1' or '$hold2' order by land");
while($myrow=MySQL_fetch_array($result)) {
$spiller = $myrow['navn'];
$spiller_id = $myrow['spiller_id'];
echo "<option value='$spiller_id'>$spiller</option>";
}
?>
</select></td>
<td>
<?php echo $myrow[maal] ?></td>
</td></tr>
</tr>
<td><input type=submit name=opdater value="opdater"></td>
</table>
</form>
