onchange funz net :(

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • onchange funz net :(

    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.
    PHP-Code:
    <?PHP
        
    include 'includes/config.php';

        @
    mysql_connect(MYSQL_HOSTMYSQL_USERMYSQL_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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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&nbsp;&nbsp; <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&nbsp;&nbsp; <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&nbsp;&nbsp; <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&nbsp;&nbsp; <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&nbsp;&nbsp; <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&nbsp;&nbsp; <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&nbsp;&nbsp; <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&nbsp;&nbsp; <input name="formelj" type="radio" value="0" checked>
                  no</td>
              </tr>
            </table>
            <div align="center"></div>
            <div align="center"></div></td>
        </tr>
        <tr> 
          <td>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</td>
          <td align="left"> <input name="submit" type="submit" class="boxtext" value="Submit"> 
            &nbsp;&nbsp; <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>
    The Human Mirror - Mein Blog!
    www.sonicsense.de - The future of music!

  • #2
    bitte in Zukunft nicht alles was du hast posten, sondern nur den relevanten Teil.

    Bitte nicht form als Formularname einsetzen und sonst alles was mit
    HTML/JS zu tun hat (Tags/Funktionsname/Methoden/Eigenschaften) nicht als
    ElementenName verwenden. Das soll nicht nur in HTML-Asugabe sein,
    sondern allgemein in allen Programier-/ScriptSprachen. Wenn es dir
    nichts sinvolles einfällt dann bitte einfach ein Underline dranhängen,
    das reicht ja auch schon.

    zu deinem Problem: onchange="document.formname.submit();"

    Kommentar


    • #3
      Hi,
      funktioniert leider nicht.

      Mozilla sagt garnichts, IE sagt "Objekt unterstützt diese Eigenschaft oder Methode nich"

      so sieht es nun aus:

      PHP-Code:
      <class="head2">Create Ranking</p>
      <
      form enctype="multipart/form-data" name="crank" 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.crank.submit();">
                  <
      option value="f1" selected>Formula 1</option>
                  <
      option value="f2" selected>Formula 2</option>
                </
      select>
                <
      br
      The Human Mirror - Mein Blog!
      www.sonicsense.de - The future of music!

      Kommentar


      • #4
        was soll denn das hier?
        PHP-Code:
        action="?action=a_createranking&member_admin=admin" 

        Kommentar


        • #5
          Das soll schon da sein.

          Per submitbutton geht das Formular einwandfrei.
          The Human Mirror - Mein Blog!
          www.sonicsense.de - The future of music!

          Kommentar


          • #6
            Hm..., so wie es da steht, funz auch bei mir einwandfrei, egal welche Browser.

            Frage: warum 2 x selected?

            Kommentar

            Lädt...
            X