tutorials.de Buch-Aktion 02/2012
ERLEDIGT
JA
ANTWORTEN
14
ZUGRIFFE
910
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    BlackWolf BlackWolf ist offline Mitglied
    Registriert seit
    Mar 2004
    Beiträge
    20
    hallo ich habe hier ein kleines/großes problem und zwar möchte ich eine variable aus einem script mit einem dorp down feld übergeben.
    Code :
    1
    2
    3
    4
    5
    6
    
    <form method="POST" action="download_download.php?id=$dldata[id]&url=$url">
                    <p style="margin-top: 0; margin-bottom: 0">
                    <select size="1" name="mirrors">
                    <option selected value="download_download.php?id=$dldata[id]&amp;url=$url"><?php echo $mirrorsview; ?></option>
                    </select><input type="submit" value="Download" name="download"></p>
                </form>
    kann mir da einer weiter helfen?
     

  2. #2
    theCean theCean ist offline Mitglied Gold
    Registriert seit
    Nov 2003
    Beiträge
    168
    Ehm, vielleicht solltest du sagen was genau du übergeben willst, irgentwie is der Quelltext bisschen komisch
     

  3. #3
    BlackWolf BlackWolf ist offline Mitglied
    Registriert seit
    Mar 2004
    Beiträge
    20
    ich muss die variabel $dldata[id] und $url übergeben
    sie muss in so einem link sein
    download_download.php?id=$dldata[id]&url=$url
     

  4. #4
    theCean theCean ist offline Mitglied Gold
    Registriert seit
    Nov 2003
    Beiträge
    168
    Code :
    1
    2
    3
    4
    5
    6
    
    <p style="margin-top: 0; margin-bottom: 0">
    <form method="POST" action="download_download.php?id=<? echo $dldata[id]; ?>&url=<? echo $url; ?>">
    <select size="1" name="mirrors">
    <option selected><?php echo $mirrorsview; ?></option>
    </select><input type="submit" value="Download" name="download"></p>
    </form>
    Also so gehts wenn du nur die 2 Variablen übergeben musst...
     

  5. #5
    BlackWolf BlackWolf ist offline Mitglied
    Registriert seit
    Mar 2004
    Beiträge
    20
    danke!
    war selber zu doof um die php tags zu machen!
    jetzt aber noch eine frage kann ich machen das wenn ich auf download klicke sich dann ein normales browser fenster öffnet also das er die seite wenn ich auf download klicke eine neue seite öffnet?
     

  6. #6
    Avatar von Sven Mintel
    Sven Mintel Sven Mintel ist offline Mitglied
    Registriert seit
    Aug 2003
    Beiträge
    18.238
    Blog-Einträge
    6
    Code :
    1
    
    <form [b]target="_blank"[/b]>
     

  7. #7
    BlackWolf BlackWolf ist offline Mitglied
    Registriert seit
    Mar 2004
    Beiträge
    20
    und jetzt kommt bei mir noch hinzu das ich manchmal mehre auswahl möglichkeiten hab und die sind nicht untereinander sondern neben einander.
    hier wird $mirrorsview definiert
    PHP-Code:
    $mirrorsview .= "<option selected><a href=\"download_download.php?id=$dldata[id]&url=$url\">Mirror $i</a> <small>($hosters[$i2])</small></option><br>"
    bis jetzt habe ich das so gemacht er zeigt sie ach untereinander an aber dann habe ich das problem das er nur den link vom einem server benutzt
    PS: er benutzt immer nur den letzten link
    Geändert von BlackWolf (24.12.04 um 11:30 Uhr)
     

  8. #8
    theCean theCean ist offline Mitglied Gold
    Registriert seit
    Nov 2003
    Beiträge
    168
    also ich versteh dein Problem nicht ganz, aber du kannst verschiedene Daten in den verschiedenen <select> feldern übergeben, und zwar so:
    Code :
    1
    2
    3
    4
    5
    6
    7
    
    <form method="POST" action="download_download.php?id=<? echo $dldata[id]; ?>&url=<? echo $url; ?>">
    <select size="1" name="mirrors">
    <option selected value='<? echo $data; ?>'>Blargh</option>
    <option selected value='<? echo $another_data.'||'.$and_another ?>'>Blargh</option>
    </select>
    <input type="submit" value="Download" name="download">
    </form>
    so kannst du diese daten in der download_download.php verwenden:
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    $mirrors=$_POST[mirrors];
    if(count(explode("||",$mirrors))>1)
    {
      $mirrors=explode("||",$mirrors);
      $i=0;
      foreach($mirrors as $mirror);
      {
        $data[$i]=$mirror;
        $i++;
      }
    } else {
      $data[0]=$mirrors;
    }
     

  9. #9
    BlackWolf BlackWolf ist offline Mitglied
    Registriert seit
    Mar 2004
    Beiträge
    20
    sorry das verstehe ich nicht ganz!
    ich versuche es mal besser zu erklären!
    ich habe viele mirrors
    z.B
    Mirror 1
    Mirror 2
    Mirror 3
    und die muss ich im drop down feld alle untereinander kriegen
    das habe ich auch geschaft aber wenn ich jetzt mirror 1 oder mirror 2 auswähle nimmt er immer den Link vom letzten MIrror also hier Mirror 3.
     

  10. #10
    BlackWolf BlackWolf ist offline Mitglied
    Registriert seit
    Mar 2004
    Beiträge
    20
    kann mir den keiner helfen?
     

  11. #11
    theCean theCean ist offline Mitglied Gold
    Registriert seit
    Nov 2003
    Beiträge
    168
    Poste:
    1. Mehr code, dass wir auch verstehen wofür die einzelnen variablen gut sind
    2. Bessere Fehler beschreibung

    Dann hilft dir vielleicht wer!
     

  12. #12
    BlackWolf BlackWolf ist offline Mitglied
    Registriert seit
    Mar 2004
    Beiträge
    20
    ok unten ist der ganze code von der download_view.php
    Mit dem Code klappt das aber nicht
    http://www.games-reactor.com/downloa...iew.php?id=192
    auf der website sieht man halt die download_view.php
    im drop down feld sind 8 Mirrors.
    aber wenn ich mirror 1 auswähle und dann auf download drücke nimmt das script die url von mirror 8 genauso ist es auch wenn ich einen anderen mirror nehme z.B. 6 dann nimmt das script immer den link zum download von mirror 8
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    
    <html>
    <head>
    <style>
    a:link {color: white; text-decoration: none; font-family: Verdana; size: 8px; }
    a:visited {color: white; text-decoration: none; font-family: Verdana; size: 8px; }
    a:active {color: white; text-decoration: none; font-family: Verdana; size: 8px; }
    a:hover {color: #00ff00; text-decoration: none; font-family: Verdana; size: 8px; }
    </style>
    <script language="JavaScript" type="text/javascript">
    <!--
     
    var width=400;
    var height=290;
     
    window.resizeTo(width,height);
     
    //-->
    </script>
    </head>
    <body>
    <font color="#FFFFFF">
    <?php
     
    include("inc_header.php");
     
    $query_handle_download = mysql_query
        ("SELECT * from mad_downloads WHERE id=$id", $db_handle);
    $dldata = mysql_fetch_array($query_handle_download);
     
    $comments = explode("|", $dldata[comments]);
     
    if(isset($send_comment)) {
     
        $thisdate = get_id();
     
        $writecomment_comment = make_mysqlable($writecomment_comment);
        $writecomment_name = make_mysqlable($writecomment_name);
     
        if(count($comments)<3) {
            $comments=array($writecomment_comment, $thisdate, $writecomment_name);
        } else {
            $comments[] = $writecomment_comment;
            $comments[] = $thisdate;
            $comments[] = $writecomment_name;
        }
     
        $dldata[comments] = implode("|", $comments);
     
        mysql_query("UPDATE mad_downloads SET comments='$dldata[comments]' WHERE id=$id", $db_handle);
     
    }
     
    if(isset($send_rating)) {
     
        if($dldata[rating]!="0") $dldata[rating] = round((($dldata[rating]+$sendrating_rating)/2),2);
        else $dldata[rating]=$sendrating_rating;
     
        mysql_query("UPDATE mad_downloads SET rating='$dldata[rating]' WHERE id=$id", $db_handle);
     
    }
     
    $viewdate = get_date($dldata[id]);
     
    $howmuch_comments = round(count($comments)/3);
    $mirrors = explode("§",$dldata[url]);
    $hosters = explode("§",$dldata[hoster]);
    $i=1;
    foreach($mirrors AS $url) {
        $i2 = $i-1;
        $mirrorsview .= "<option><a href=\"download_download.php?id=$dldata[id]&url=$url\">Mirror $i</a> <small>($hosters[$i2])</small></option><br>";
        $i++;
    }
    ?>
     
    <script type="text/javascript">
    <!--
    function checkComment()
    {
     if(document.comment.writecomment_name.value == "")  {
       alert("Bitte Ihren Namen eingeben!");
       document.comment.writecomment_name.focus();
       return false;
      }
     if(document.comment.writecomment_comment.value == "") {
       alert("Bitte einen Text eingeben!");
       document.comment.writecomment_comment.focus();
       return false;
      }
    }
    //-->
    </script>
     
     
    </font>
     
     
    <body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
     
     
    <div align="left">
     
     
    <table class="content" bgcolor="#535356" style="border-collapse: collapse" border="1" bordercolor="#DCD903" width="400" height="290">
        <tr>
            <td class="cell2" width="35%" height="5%">
                <p style="margin-top: 0; margin-bottom: 0">
                <font face="Verdana" size="1" color="#FFFFFF">Titel
            </font>
            </td>
            <td class="cell2" width="70%" height="5%">
                <font face="Verdana" size="1" color="#FFFFFF">
                <?php echo $dldata[headline]; ?>
            </font>
            </td>
        </tr>
        <tr>
            <td class="cell1" width="35%" height="5%">
                <p style="margin-top: 0; margin-bottom: 0">
                <font face="Verdana" size="1" color="#FFFFFF">Autor
            </font>
            </td>
            <td class="cell1" width="70%" height="5%">
                <font face="Verdana" size="1" color="#FFFFFF">
                <?php echo $dldata[autor]; ?>
            </font>
            </td>
        </tr>
        <tr>
            <td class="cell2" width="35%" height="5%">
                <p style="margin-top: 0; margin-bottom: 0">
                <font face="Verdana" size="1" color="#FFFFFF">Dateigröße
            </font>
            </td>
            <td class="cell2" width="70%" height="5%">
                <font face="Verdana" size="1" color="#FFFFFF">
                <?php echo $dldata[size]; ?>
            </font>
            </td>
        </tr>
        <tr>
            <td class="cell2" width="35%" height="5%">
                <p style="margin-top: 0; margin-bottom: 0">
                <font face="Verdana" size="1" color="#FFFFFF">Downloads</font></td>
            <td class="cell2" width="166" height="5%">
                <font face="Verdana" size="1" color="#FFFFFF">
                <?php echo $dldata[downloads]; ?>
            </font>
            </td>
        </tr>
        <tr>
            <td class="cell2" colspan="2" align="center" valign="top" height="1%">
                <div align="center">
    <font color="#FFFFFF">
    <?
    $minuten = 60;
     
    $modem = 7;
     
    $isdn = 8;
     
    $dsl = 96;
     
    $dsl1k = 125;
     
    $dsl2k = 250;
     
    $dsl3k = 375;
     
    $tausend = 1000;
     
    $berechnung_modem = $dldata[size] * $tausend / $modem / $minuten;
     
    $berechnung_isdn = $dldata[size] * $tausend / $isdn / $minuten;
     
    $berechnung_dsl = $dldata[size] * $tausend / $dsl / $minuten;
     
    $berechnung_dsl1k = $dldata[size] * $tausend / $dsl1k / $minuten;
     
    $berechnung_dsl2k = $dldata[size] * $tausend / $dsl2k/ $minuten;
     
    $berechnung_dsl3k = $dldata[size] * $tausend / $dsl3k / $minuten;
     
    $ergebnis_modem = round ($berechnung_modem);
     
    $ergebnis_isdn = round ($berechnung_isdn);
     
    $ergebnis_dsl = round ($berechnung_dsl);
     
    $ergebnis_dsl1k = round ($berechnung_dsl1k);
     
    $ergebnis_dsl2k = round ($berechnung_dsl2k);
     
    $ergebnis_dsl3k = round ($berechnung_dsl3k);
    ?>
                    </font>
                    <table border="0" width="80%" style="border-collapse: collapse">
                        <tr>
                            <td width="50%">
                            <p style="margin-top: 0; margin-bottom: 0">
                            <font face="Verdana" size="1" color="#FFFFFF">Modem</font></td>
                            <td>
                            <p style="margin-top: 0; margin-bottom: 0">
                            <font face="Verdana" size="1" color="#FFFFFF"><? echo $ergebnis_modem; ?> Minuten</font></td>
                        </tr>
                        <tr>
                            <td width="50%">
                            <p style="margin-top: 0; margin-bottom: 0">
                            <font face="Verdana" size="1" color="#FFFFFF">ISDN
                            </font></td>
                            <td>
                            <p style="margin-top: 0; margin-bottom: 0">
                            <font face="Verdana" size="1" color="#FFFFFF"><? echo $ergebnis_isdn; ?> Minuten</font></td>
                        </tr>
                        <tr>
                            <td width="50%">
                            <p style="margin-top: 0; margin-bottom: 0">
                            <font face="Verdana" size="1" color="#FFFFFF">DSL</font></td>
                            <td>
                            <p style="margin-top: 0; margin-bottom: 0">
                            <font face="Verdana" size="1" color="#FFFFFF"><? echo $ergebnis_dsl; ?> Minuten</font></td>
                        </tr>
                        <tr>
                            <td width="50%">
                            <p style="margin-top: 0; margin-bottom: 0">
                            <font face="Verdana" size="1" color="#FFFFFF">DSL 1000</font></td>
                            <td>
                            <p style="margin-top: 0; margin-bottom: 0">
                            <font face="Verdana" size="1" color="#FFFFFF"><? echo $ergebnis_dsl1k; ?> Minuten</font></td>
                        </tr>
                        <tr>
                            <td width="50%">
                            <p style="margin-top: 0; margin-bottom: 0">
                            <font face="Verdana" size="1" color="#FFFFFF">DSL 2000</font></td>
                            <td>
                            <p style="margin-top: 0; margin-bottom: 0">
                            <font face="Verdana" size="1" color="#FFFFFF"><? echo $ergebnis_dsl2k; ?> Minuten</font></td>
                        </tr>
                        <tr>
                            <td width="50%">
                            <p style="margin-top: 0; margin-bottom: 0">
                            <font face="Verdana" size="1" color="#FFFFFF">DSL 3000</font></td>
                            <td>
                            <p style="margin-top: 0; margin-bottom: 0">
                            <font face="Verdana" size="1" color="#FFFFFF"><? echo $ergebnis_dsl3k; ?> Minuten</font></td>
                        </tr>
                    </table>
                </div>
            </td>
        </tr>
        <tr>
        <td class="cell2" colspan="2" align="center" height="102" valign="top">
        <p style="margin-top: 0; margin-bottom: 0">
                <form target="_blank" method="POST" action="download_download.php?id=<? echo $dldata[id]; ?>&url=<? echo $url; ?>">
        <select size="1" name="mirrors" style="color: #FFFFFF; font-size: 8pt; font-family: Verdana; border: 1px solid #00FF00; background-color: #535356">
        <?php echo $mirrorsview; ?>
        </select>
                <input type="submit" value="Download" name="download" style="color: #FFFFFF; font-size: 8pt; font-family: Verdana; border: 1px solid #00FF00; background-color: #535356"></p>
                    </form>
        </td>
        </tr>
        </table>
        </div><font color="#FFFFFF"><br>
     
     
     
        </font>
     
     
     
    </body>
    </html>
    <?
     
    include("inc_footer.php");
    ?>
    Geändert von BlackWolf (26.12.04 um 01:51 Uhr)
     

  13. #13
    BlackWolf BlackWolf ist offline Mitglied
    Registriert seit
    Mar 2004
    Beiträge
    20
    sorry doppel post!
    Geändert von BlackWolf (26.12.04 um 01:51 Uhr)
     

  14. #14
    BlackWolf BlackWolf ist offline Mitglied
    Registriert seit
    Mar 2004
    Beiträge
    20
    kann mir den niemand helfen?
     

  15. #15
    Trash Trash ist offline Mitglied Brokat
    Registriert seit
    Jan 2002
    Beiträge
    388
    Ich verstehe grad nicht warum es heißt:

    PHP-Code:
    $mirrorsview .= 
    Die Variable wird doch vorher garnicht deklariert, also muss es doch schonmal

    PHP-Code:
    $mirrorsview 
    heißen. Und wenn du die Rules liesst steht da "Man soll nicht 200 Zeilen Code posten und dann fragen was nicht geht... Und man braucht Geduld.
    Was ich z.B. nicht verstehe, warum du es so kompliziert machst.

    Wenn du den Hosternamen und die DL-URL in eine Datenbank speicherst reicht doch schon fast sowas:

    PHP-Code:
    $query = mysql_query("SELECT * FROM tabelle WHERE id = '".$_GET['id']."'");
    while  ($result = mysql_fetch_array($query))
    {
    ?>
    <option value="<?=$result['url']?>"><?=$result['hoster']?></option>
    <?
    }
    ?>
     

Ähnliche Themen

  1. Abfrage mit Dropdown Feld
    Von al-Maghribi im Forum PHP
    Antworten: 3
    Letzter Beitrag: 19.03.08, 12:24
  2. Typo3 Varibalen übergeben/Externe Datenbank
    Von luckerking im Forum Content Management Systeme (CMS)
    Antworten: 0
    Letzter Beitrag: 28.02.08, 11:22
  3. Typo3 Varibalen übergeben
    Von luckerking im Forum PHP
    Antworten: 0
    Letzter Beitrag: 28.02.08, 10:57
  4. DropDown Feld
    Von Blümchen im Forum PHP
    Antworten: 12
    Letzter Beitrag: 12.07.05, 14:14
  5. Antworten: 3
    Letzter Beitrag: 17.04.05, 22:21