Hiho,
Bei einer Selectbox soll nach dem auswählen das Form verschickt werden. onChange wäre doch richtig.
klingt komisch, ist aber so.
Hier mal der Code.
Bei einer Selectbox soll nach dem auswählen das Form verschickt werden. onChange wäre doch richtig.
klingt komisch, ist aber so.
Hier mal der Code.
PHP-Code:
<?PHP
include 'includes/config.php';
@mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS) OR
die("Keine Verbindung zur Datenbank. Fehlermeldung:".mysql_error());
mysql_select_db(MYSQL_DATABASE) OR
die("Konnte Datenbank nicht benutzen, Fehlermeldung: ".mysql_error());
if($submit){
$formula = $_POST['selectformula'];
if($formula = "f1"){
$sql_h1 = "SELECT *
FROM
mx_rankingsf1
ORDER BY
pos ASC;";
}
$result_h1 = mysql_query($sql_h1) OR die(mysql_error());
}
$sql = "SELECT *
FROM
mx_locations
ORDER BY
location ASC;";
$result = mysql_query($sql) OR die(mysql_error());
?>
<link href="../css/hrn.css" rel="stylesheet" type="text/css">
<br>
<p class="head2">Create Ranking</p>
<form enctype="multipart/form-data" name="form" action="?action=a_createranking&member_admin=admin" method="post">
<table width="500" border="0" cellpadding="0" cellspacing="0" class="fliesstext">
<tr>
<td valign="top"><span class="boxtext"><b>Formula</b></span></td>
<td valign="top"> <div align="left">
<select name="selectformula" class="boxtext" onChange="document.form.submit()">
<option value="f1" selected>Formula 1</option>
<option value="f2" selected>Formula 2</option>
</select>
<br>
</div></td>
</tr>
<tr>
<td> </td>
<td> <div align="left"><br>
</div></td>
</tr>
<? if($submit){
?>
<tr>
<td valign="top"><span class="boxtext"><b>Driver</b></span></td>
<td valign="top"> <div align="left">
<select name="selectdriver" class="boxtext" onChange="form.submit()">
<?php
while($row_driver = mysql_fetch_assoc($result_h1)) {
?>
<option selected><? echo ''.$row_driver['name'].'' ?></option>
<?
}
?>
</select>
<br>
</div></td>
</tr>
<?
}
?>
<tr>
<td> </td>
<td> <div align="left"><br>
</div></td>
</tr>
<tr>
<td valign="top"><span class="boxtext"><b>Pos</b></span></td>
<td valign="top"> <div align="left">
<input name="pos" type="text" class="boxtext" id="firstname" style="width: 240px;" value="" size="42">
<br>
</div></td>
</tr>
<tr>
<td> </td>
<td> <div align="left"><br>
</div></td>
</tr>
<tr>
<td valign="top"><span class="boxtext"><b>Fahrer Nr</b></span></td>
<td valign="top"> <div align="left">
<input name="nr" type="text" class="boxtext" id="lastname" style="width: 240px;" value="" size="42">
<br>
</div></td>
</tr>
<tr>
<td> </td>
<td> <div align="left"><br>
</div></td>
</tr>
<tr>
<td valign="top"><span class="boxtext"><b>Name</b></span></td>
<td valign="top"> <div align="left">
<input class="boxtext" style="width: 240px;" size="42" type="text" name="name" value="">
<br>
</div></td>
</tr>
<tr>
<td> </td>
<td> <div align="left"><br>
</div></td>
</tr>
<tr>
<td valign="top"><span class="boxtext"><b>Location</b></span></td>
<td valign="top"> <div align="left">
<select name="menu1" class="boxtext">
<?php
while($row = mysql_fetch_assoc($result)) {
?>
<option selected><? echo ''.$row['location'].'' ?></option>
<?
}
?>
</select>
<br>
</div></td>
</tr>
<tr>
<td> </td>
<td> <div align="left"><br>
</div></td>
</tr>
<tr>
<td valign="top"><span class="boxtext"><b>Formel</b></span></td>
<td valign="top"> <div align="center"></div>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="fliesstext">Formula 1</td>
<td class="fliesstext"> <input type="radio" name="formel1" value="1">
yes <input name="formel1" type="radio" value="0" checked>
no </td>
</tr>
<tr>
<td class="fliesstext">Formula 2</td>
<td class="fliesstext"> <input type="radio" name="formel2" value="1">
yes <input name="formel2" type="radio" value="0" checked>
no</td>
</tr>
<tr>
<td class="fliesstext">Formula 3</td>
<td class="fliesstext"> <input type="radio" name="formel3" value="1">
yes <input name="formel3" type="radio" value="0" checked>
no</td>
</tr>
<tr>
<td class="fliesstext">Formula N</td>
<td class="fliesstext"> <input type="radio" name="formeln" value="1">
yes <input name="formeln" type="radio" value="0" checked>
no</td>
</tr>
<tr>
<td class="fliesstext">Formula S</td>
<td class="fliesstext"> <input type="radio" name="formels" value="1">
yes <input name="formels" type="radio" value="0" checked>
no</td>
</tr>
<tr>
<td class="fliesstext">Formula 25</td>
<td class="fliesstext"> <input type="radio" name="formel25" value="1">
yes <input name="formel25" type="radio" value="0" checked>
no</td>
</tr>
<tr>
<td class="fliesstext">Formula 503</td>
<td class="fliesstext"> <input type="radio" name="formel503" value="1">
yes <input name="formel503" type="radio" value="0" checked>
no</td>
</tr>
<tr>
<td class="fliesstext">Formula J</td>
<td class="fliesstext"> <input type="radio" name="formelj" value="1">
yes <input name="formelj" type="radio" value="0" checked>
no</td>
</tr>
</table>
<div align="center"></div>
<div align="center"></div></td>
</tr>
<tr>
<td> </td>
<td> <div align="left"><br>
</div></td>
</tr>
<tr>
<td valign="top"><span class="boxtext"><b>Heat 1</b></span></td>
<td valign="top"> <div align="left">
<input class="boxtext" style="width: 240px;" size="42" type="text" name="l1" value="">
<br>
</div></td>
</tr>
<tr>
<td> </td>
<td> <div align="left"><br>
</div></td>
</tr>
<tr>
<td valign="top"><span class="boxtext"><b>Heat 2</b></span></td>
<td valign="top"> <div align="left">
<input class="boxtext" style="width: 240px;" size="42" type="text" name="l2" value="">
<br>
</div></td>
</tr>
<tr>
<td> </td>
<td> <div align="left"><br>
</div></td>
</tr>
<tr>
<td valign="top"><span class="boxtext"><b>Heat 3</b></span></td>
<td valign="top"> <div align="left">
<input class="boxtext" style="width: 240px;" size="42" type="text" name="l3" value="">
<br>
</div></td>
</tr>
<tr>
<td> </td>
<td> <div align="left"><br>
</div></td>
</tr>
<tr>
<td valign="top" class="boxtext"><span class="boxtext"><b>Heat 4</b></span></td>
<td valign="top"> <div align="left">
<input class="boxtext" style="width: 240px;" size="42" type="text" name="l4" value="">
<br>
</div></td>
</tr>
<tr>
<td> </td>
<td> <div align="left"><br>
</div></td>
</tr>
<tr>
<td valign="top" class="boxtext"><span class="boxtext"><b>Total</b></span></td>
<td valign="top"> <div align="left">
<input class="boxtext" style="width: 240px;" size="42" type="text" name="total" value="">
<br>
</div></td>
</tr>
<tr>
<td colspan="2"><img src="../member/profiles/images/spacer.gif" height="10" width="1"></td>
</tr>
<tr>
<td> </td>
<td align="left"> <input name="submit" type="submit" class="boxtext" value="Submit">
<input name="reset" type="reset" class="boxtext" value="Clear">
</td>
</tr>
<tr>
<td colspan="2"><img src="../member/profiles/images/spacer.gif" height="15" width="1"></td>
</tr>
</table>
</form>
Kommentar