tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
9
ZUGRIFFE
773
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    Registriert seit
    Apr 2005
    Ort
    Schwabenländle
    Beiträge
    499
    Heho

    Ich hab ein kleines-großes ASP Problem und hoffe, dass mir hier endlich geholfen werden kann.
    Kurz vorne weg: Ich hab wirklich keine Ahnung von ASP... und versuche das ganze irgendwie mit Dreamweaver zu lösen...

    Hab nun die Aufgabe bekommen, eine Art Selektion zu erstellen.
    Habe nun als Beispiel ein Mittagessen.
    Ich hab in der Datenbank 6 Tabellen angelegt die jeweils das Feld ID, Auswahl und Bild haben.

    Beispeil Tabelle Vorspeise:
    ID - Auswahl - Bild
    1 - Suppe - suppe.jpg
    2 - Salat - salat.jpg

    Die Checkboxen und die Bereiche zu wiederholen hab ich noch hinbekommen (auch wenn ich nicht sicher bin, ob ich sie überhaupt nach dem richtigen Wert sortiert werden.)
    Nun soll aber folgendes passieren, wenn ich eine Checkbox anwähle:
    Unter der Übersicht sollte sich eine Tabelle mit 2 Zeilen und 3 Spalten befinden.
    Wenn man die Seite aufruft, sollen Platzhalter/Spacer angezeigt werden.
    Wenn ich nun z.B. bei Vorspeise 'Suppe' auswähle soll er das dementsprechende Bild laden und den Platzhalter durch dieses ersetzen... und das ist mein Problem.. ich hab keine Ahnung, wie ich das hinbekommen soll

    Hier mal noch mein Code:
    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
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <!--#include file="Connections/blubb.asp" -->
    <%
    Dim Beilage_1__MMColParam
    Beilage_1__MMColParam = "ID_Beilage1"
    If (Request("MM_EmptyValue") <> "") Then 
      Beilage_1__MMColParam = Request("MM_EmptyValue")
    End If
    %>
    <%
    Dim Beilage_1
    Dim Beilage_1_numRows
     
    Set Beilage_1 = Server.CreateObject("ADODB.Recordset")
    Beilage_1.ActiveConnection = MM_blubb_STRING
    Beilage_1.Source = "SELECT * FROM Beilage_1 WHERE ID_Beilage1 = " + Replace(Beilage_1__MMColParam, "'", "''") + " ORDER BY ID_Beilage1 ASC"
    Beilage_1.CursorType = 0
    Beilage_1.CursorLocation = 2
    Beilage_1.LockType = 1
    Beilage_1.Open()
     
    Beilage_1_numRows = 0
    %>
    <%
    Dim Beilage_2__MMColParam
    Beilage_2__MMColParam = "ID_Beilage2"
    If (Request("MM_EmptyValue") <> "") Then 
      Beilage_2__MMColParam = Request("MM_EmptyValue")
    End If
    %>
    <%
    Dim Beilage_2
    Dim Beilage_2_numRows
     
    Set Beilage_2 = Server.CreateObject("ADODB.Recordset")
    Beilage_2.ActiveConnection = MM_blubb_STRING
    Beilage_2.Source = "SELECT * FROM Beilage_2 WHERE ID_Beilage2 = " + Replace(Beilage_2__MMColParam, "'", "''") + " ORDER BY ID_Beilage2 DESC"
    Beilage_2.CursorType = 0
    Beilage_2.CursorLocation = 2
    Beilage_2.LockType = 1
    Beilage_2.Open()
     
    Beilage_2_numRows = 0
    %>
    <%
    Dim Hauptgang__MMColParam
    Hauptgang__MMColParam = "ID_Hauotgang"
    If (Request("MM_EmptyValue") <> "") Then 
      Hauptgang__MMColParam = Request("MM_EmptyValue")
    End If
    %>
    <%
    Dim Hauptgang
    Dim Hauptgang_numRows
     
    Set Hauptgang = Server.CreateObject("ADODB.Recordset")
    Hauptgang.ActiveConnection = MM_blubb_STRING
    Hauptgang.Source = "SELECT * FROM Hauptgang WHERE ID_Hauotgang = " + Replace(Hauptgang__MMColParam, "'", "''") + " ORDER BY ID_Hauotgang ASC"
    Hauptgang.CursorType = 0
    Hauptgang.CursorLocation = 2
    Hauptgang.LockType = 1
    Hauptgang.Open()
     
    Hauptgang_numRows = 0
    %>
    <%
    Dim Nachtisch__MMColParam
    Nachtisch__MMColParam = "ID_Nachtisch"
    If (Request("MM_EmptyValue") <> "") Then 
      Nachtisch__MMColParam = Request("MM_EmptyValue")
    End If
    %>
    <%
    Dim Nachtisch
    Dim Nachtisch_numRows
     
    Set Nachtisch = Server.CreateObject("ADODB.Recordset")
    Nachtisch.ActiveConnection = MM_blubb_STRING
    Nachtisch.Source = "SELECT * FROM Nachtisch WHERE ID_Nachtisch = " + Replace(Nachtisch__MMColParam, "'", "''") + " ORDER BY ID_Nachtisch ASC"
    Nachtisch.CursorType = 0
    Nachtisch.CursorLocation = 2
    Nachtisch.LockType = 1
    Nachtisch.Open()
     
    Nachtisch_numRows = 0
    %>
    <%
    Dim Trinken__MMColParam
    Trinken__MMColParam = "ID_Trinken"
    If (Request("MM_EmptyValue") <> "") Then 
      Trinken__MMColParam = Request("MM_EmptyValue")
    End If
    %>
    <%
    Dim Trinken
    Dim Trinken_numRows
     
    Set Trinken = Server.CreateObject("ADODB.Recordset")
    Trinken.ActiveConnection = MM_blubb_STRING
    Trinken.Source = "SELECT * FROM Trinken WHERE ID_Trinken = " + Replace(Trinken__MMColParam, "'", "''") + " ORDER BY ID_Trinken ASC"
    Trinken.CursorType = 0
    Trinken.CursorLocation = 2
    Trinken.LockType = 1
    Trinken.Open()
     
    Trinken_numRows = 0
    %>
    <%
    Dim Vorspeise__MMColParam
    Vorspeise__MMColParam = "ID_Vorspeise"
    If (Request("MM_EmptyValue") <> "") Then 
      Vorspeise__MMColParam = Request("MM_EmptyValue")
    End If
    %>
    <%
    Dim Vorspeise
    Dim Vorspeise_numRows
     
    Set Vorspeise = Server.CreateObject("ADODB.Recordset")
    Vorspeise.ActiveConnection = MM_blubb_STRING
    Vorspeise.Source = "SELECT * FROM Vorspeise WHERE ID_Vorspeise = " + Replace(Vorspeise__MMColParam, "'", "''") + " ORDER BY ID_Vorspeise ASC"
    Vorspeise.CursorType = 0
    Vorspeise.CursorLocation = 2
    Vorspeise.LockType = 1
    Vorspeise.Open()
     
    Vorspeise_numRows = 0
    %>
    <%
    Dim Repeat1__numRows
    Dim Repeat1__index
     
    Repeat1__numRows = -1
    Repeat1__index = 0
    Vorspeise_numRows = Vorspeise_numRows + Repeat1__numRows
    %>
    <%
    Dim Repeat2__numRows
    Dim Repeat2__index
     
    Repeat2__numRows = -1
    Repeat2__index = 0
    Hauptgang_numRows = Hauptgang_numRows + Repeat2__numRows
    %>
    <%
    Dim Repeat3__numRows
    Dim Repeat3__index
     
    Repeat3__numRows = -1
    Repeat3__index = 0
    Beilage_1_numRows = Beilage_1_numRows + Repeat3__numRows
    %>
    <%
    Dim Repeat4__numRows
    Dim Repeat4__index
     
    Repeat4__numRows = -1
    Repeat4__index = 0
    Beilage_2_numRows = Beilage_2_numRows + Repeat4__numRows
    %>
    <%
    Dim Repeat5__numRows
    Dim Repeat5__index
     
    Repeat5__numRows = -1
    Repeat5__index = 0
    Trinken_numRows = Trinken_numRows + Repeat5__numRows
    %>
    <%
    Dim Repeat6__numRows
    Dim Repeat6__index
     
    Repeat6__numRows = -1
    Repeat6__index = 0
    Nachtisch_numRows = Nachtisch_numRows + Repeat6__numRows
    %>
    <html>
    <head>
    <title>Unbenanntes Dokument</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    body {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 10pt;
        color: #000000;
    }
    table {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 10pt;
        color: #000000;
    }
    -->
    </style>
    </head>
     
    <body><form name="form1" method="post" action="">
      <div align="center">
        <table width="900" border="0" cellspacing="1" cellpadding="1">
          <tr> 
            <td><strong>Vorspeise</strong></td>
            <td><strong>Hautpgang</strong></td>
            <td><strong>Beilage1</strong></td>
            <td><strong>Beilage2</strong></td>
            <td><strong>Trinken</strong></td>
            <td><strong>Nachtisch</strong></td>
          </tr>
          <tr valign="top"> 
            <td> <p> 
                <% 
    While ((Repeat1__numRows <> 0) AND (NOT Vorspeise.EOF)) 
    %>
                <label> 
                <input <%If (CStr((Vorspeise.Fields.Item("Auswahl").Value)) = CStr("vorspeise")) Then Response.Write("CHECKED") : Response.Write("")%> type="radio" name="vorspeise" value="vorspeise">
                </label>
                <%=(Vorspeise.Fields.Item("Auswahl").Value)%> <br>
                <% 
      Repeat1__index=Repeat1__index+1
      Repeat1__numRows=Repeat1__numRows-1
      Vorspeise.MoveNext()
    Wend
    %>
              </p>
              <br> </td>
            <td> <p> 
                <% 
    While ((Repeat2__numRows <> 0) AND (NOT Hauptgang.EOF)) 
    %>
                <label> 
                <input <%If (CStr((Hauptgang.Fields.Item("Auswahl").Value)) = CStr("hauptgang")) Then Response.Write("CHECKED") : Response.Write("")%> type="radio" name="hauptgang" value="hauptgang">
                </label>
                <%=(Hauptgang.Fields.Item("Auswahl").Value)%> <br>
                <% 
      Repeat2__index=Repeat2__index+1
      Repeat2__numRows=Repeat2__numRows-1
      Hauptgang.MoveNext()
    Wend
    %>
              </p></td>
            <td> <% 
    While ((Repeat3__numRows <> 0) AND (NOT Beilage_1.EOF)) 
    %>
              <label> 
              <input <%If (CStr((Beilage_1.Fields.Item("Auswahl").Value)) = CStr("beilage1")) Then Response.Write("CHECKED") : Response.Write("")%> type="radio" name="beilage_1" value="beilage1">
              </label>
              <%=(Beilage_1.Fields.Item("Auswahl").Value)%> <br>
              <% 
      Repeat3__index=Repeat3__index+1
      Repeat3__numRows=Repeat3__numRows-1
      Beilage_1.MoveNext()
    Wend
    %> </td>
            <td> <% 
    While ((Repeat4__numRows <> 0) AND (NOT Beilage_2.EOF)) 
    %>
              <label> 
              <input <%If (CStr((Beilage_2.Fields.Item("Auswahl").Value)) = CStr("beilage2")) Then Response.Write("CHECKED") : Response.Write("")%> type="radio" name="beilage_2" value="beilage2">
              </label>
              <%=(Beilage_2.Fields.Item("Auswahl").Value)%> <br>
              <% 
      Repeat4__index=Repeat4__index+1
      Repeat4__numRows=Repeat4__numRows-1
      Beilage_2.MoveNext()
    Wend
    %> </td>
            <td> <% 
    While ((Repeat5__numRows <> 0) AND (NOT Trinken.EOF)) 
    %>
              <label> 
              <input <%If (CStr((Trinken.Fields.Item("Auswahl").Value)) = CStr("trinken")) Then Response.Write("CHECKED") : Response.Write("")%> type="radio" name="trinken" value="trinken">
              </label>
              <%=(Trinken.Fields.Item("Auswahl").Value)%> <br>
              <% 
      Repeat5__index=Repeat5__index+1
      Repeat5__numRows=Repeat5__numRows-1
      Trinken.MoveNext()
    Wend
    %> </td>
            <td> <% 
    While ((Repeat6__numRows <> 0) AND (NOT Nachtisch.EOF)) 
    %>
              <label> 
              <input <%If (CStr((Nachtisch.Fields.Item("Auswahl").Value)) = CStr("nachtisch")) Then Response.Write("CHECKED") : Response.Write("")%> type="radio" name="nachtisch" value="nachtisch">
              </label>
              <%=(Nachtisch.Fields.Item("Auswahl").Value)%> <br>
              <% 
      Repeat6__index=Repeat6__index+1
      Repeat6__numRows=Repeat6__numRows-1
      Nachtisch.MoveNext()
    Wend
    %> </td>
          </tr>
        </table>
      </div>
      <p align="center">&nbsp;</p>
      <div align="center">
        <table width="600" border="0" cellspacing="1" cellpadding="1">
          <tr> 
            <td></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>
      </div>
      <p>&nbsp;</p>
    </form>
    <p>&nbsp; </p>
     
    <p>&nbsp; </p>
    </body>
    </html>
    <%
    Beilage_1.Close()
    Set Beilage_1 = Nothing
    %>
    <%
    Beilage_2.Close()
    Set Beilage_2 = Nothing
    %>
    <%
    Hauptgang.Close()
    Set Hauptgang = Nothing
    %>
    <%
    Nachtisch.Close()
    Set Nachtisch = Nothing
    %>
    <%
    Trinken.Close()
    Set Trinken = Nothing
    %>
    <%
    Vorspeise.Close()
    Set Vorspeise = Nothing
    %>

    Bin für jede - idiotensichere - Hilfe dankbar

    schutzgeist
     

  2. #2
    Registriert seit
    Aug 2003
    Ort
    Arnsberg, Germany, Germany
    Beiträge
    1.066
    Hi

    eine Dreamweaver-Lösung gibts da leider nicht.

    Du solltest den Optionsfeldern in jeder Schleife eine Zahl im Namen mitgeben, vom r0 bis r5

    Also 1. Schleife bsp.

    <input name="r0" type="radio" value="<% = rs("BildfeldVorspeise")%>">

    2. Schleife

    <input name="r1" type="radio" value="<% = rs("BildfeldGetraenke")%>">

    und so weiter.

    Wichtig ist, dass alles in allem in einem Formular abgeschickt wird. Also die Form-Tags um alle Schleifen legen.

    Dann baust Du Dir Deine Tabelle in eine for-Schleife ein. In dieser Schleife setzt Du den Standardwert für das Standardbild. Sind jetzt Optionsschalter ausgewählt und das Formular ist abgeschickt, wird im Script nach dem Vorhandensein eines Wertes gefragt und der Standardwert wird durch den übergebenen Wert des Optionsfeldes (Bild) ersetzt.

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    <%
    dim i, stWert
    with response
    .write "<table border><tr>" & vbcrlf
        for i = 0 to 5
        stWert = "standard.gif"
        if Request.Form("r" & i & "") <> "" then
            stWert = Request.Form("r" & i & "")
        end if
            .write "<td><img src=""" & stWert & """></td>" & vbcrlf
            if i = 2 then 
                .write "</tr><tr>" & vbcrlf
            end if
        next
    .write "</tr></table>"
    end with
    %>
     
    liebe Grüße, die Luzie

  3. #3
    Registriert seit
    Apr 2005
    Ort
    Schwabenländle
    Beiträge
    499
    Danke für deine Antwort.
    Aber um ehrlich zu sein versteh ich bis auf die Schleifen nur Bahnhof

    Hab seit Freitag irgendwie das ganze Script eh total übern Haufen geworfen und weiß bald nicht mehr, wo oben und unten ist
     

  4. #4
    Registriert seit
    Aug 2003
    Ort
    Arnsberg, Germany, Germany
    Beiträge
    1.066
    Hi

    nicht heulen

    Dann poste doch mal, was Du inzwischen versucht hast.
    Ansonsten kann man Dir nicht weiterhelfen, denn Hellsehen könne ma alle net, gel?
     
    liebe Grüße, die Luzie

  5. #5
    Registriert seit
    Apr 2005
    Ort
    Schwabenländle
    Beiträge
    499
    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
    
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <!--#include file="Connections/blubb.asp" -->
    <%
    Dim Beilage1
    Dim Beilage1_numRows
     
    Set Beilage1 = Server.CreateObject("ADODB.Recordset")
    Beilage1.ActiveConnection = MM_blubb_STRING
    Beilage1.Source = "SELECT * FROM Beilage_1"
    Beilage1.CursorType = 0
    Beilage1.CursorLocation = 2
    Beilage1.LockType = 1
    Beilage1.Open()
     
    Beilage1_numRows = 0
    %>
    <%
    Dim Beilage2
    Dim Beilage2_numRows
     
    Set Beilage2 = Server.CreateObject("ADODB.Recordset")
    Beilage2.ActiveConnection = MM_blubb_STRING
    Beilage2.Source = "SELECT * FROM Beilage_2"
    Beilage2.CursorType = 0
    Beilage2.CursorLocation = 2
    Beilage2.LockType = 1
    Beilage2.Open()
     
    Beilage2_numRows = 0
    %>
    <%
    Dim Hauptgang
    Dim Hauptgang_numRows
     
    Set Hauptgang = Server.CreateObject("ADODB.Recordset")
    Hauptgang.ActiveConnection = MM_blubb_STRING
    Hauptgang.Source = "SELECT * FROM Hauptgang"
    Hauptgang.CursorType = 0
    Hauptgang.CursorLocation = 2
    Hauptgang.LockType = 1
    Hauptgang.Open()
     
    Hauptgang_numRows = 0
    %>
    <%
    Dim Nachtisch
    Dim Nachtisch_numRows
     
    Set Nachtisch = Server.CreateObject("ADODB.Recordset")
    Nachtisch.ActiveConnection = MM_blubb_STRING
    Nachtisch.Source = "SELECT * FROM Nachtisch"
    Nachtisch.CursorType = 0
    Nachtisch.CursorLocation = 2
    Nachtisch.LockType = 1
    Nachtisch.Open()
     
    Nachtisch_numRows = 0
    %>
    <%
    Dim Trinken
    Dim Trinken_numRows
     
    Set Trinken = Server.CreateObject("ADODB.Recordset")
    Trinken.ActiveConnection = MM_blubb_STRING
    Trinken.Source = "SELECT * FROM Trinken"
    Trinken.CursorType = 0
    Trinken.CursorLocation = 2
    Trinken.LockType = 1
    Trinken.Open()
     
    Trinken_numRows = 0
    %>
    <%
    Dim Vorspeise
    Dim Vorspeise_numRows
     
    Set Vorspeise = Server.CreateObject("ADODB.Recordset")
    Vorspeise.ActiveConnection = MM_blubb_STRING
    Vorspeise.Source = "SELECT * FROM Vorspeise"
    Vorspeise.CursorType = 0
    Vorspeise.CursorLocation = 2
    Vorspeise.LockType = 1
    Vorspeise.Open()
     
    Vorspeise_numRows = 0
    %>
    <%
    Dim Repeat1__numRows
    Dim Repeat1__index
     
    Repeat1__numRows = -1
    Repeat1__index = 0
    Vorspeise_numRows = Vorspeise_numRows + Repeat1__numRows
    %>
    <%
    Dim Repeat2__numRows
    Dim Repeat2__index
     
    Repeat2__numRows = -1
    Repeat2__index = 0
    Hauptgang_numRows = Hauptgang_numRows + Repeat2__numRows
    %>
    <%
    Dim Repeat3__numRows
    Dim Repeat3__index
     
    Repeat3__numRows = -1
    Repeat3__index = 0
    Beilage1_numRows = Beilage1_numRows + Repeat3__numRows
    %>
    <%
    Dim Repeat4__numRows
    Dim Repeat4__index
     
    Repeat4__numRows = -1
    Repeat4__index = 0
    Beilage2_numRows = Beilage2_numRows + Repeat4__numRows
    %>
    <%
    Dim Repeat5__numRows
    Dim Repeat5__index
     
    Repeat5__numRows = -1
    Repeat5__index = 0
    Trinken_numRows = Trinken_numRows + Repeat5__numRows
    %>
    <%
    Dim Repeat6__numRows
    Dim Repeat6__index
     
    Repeat6__numRows = -1
    Repeat6__index = 0
    Nachtisch_numRows = Nachtisch_numRows + Repeat6__numRows
    %>
    <html>
    <head>
    <title>Unbenanntes Dokument</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
     
    <body>
    <form action="" method="post" name="menue" id="menue">
      <table width="900" border="0" align="center" cellpadding="1" cellspacing="1">
        <tr valign="top"> 
          <td><strong>Vorspeise</strong></td>
          <td><strong>Hauptgang</strong></td>
          <td><strong>Beilage 1</strong></td>
          <td><strong>Beilage 2</strong></td>
          <td><strong>Trinken</strong></td>
          <td><strong>Nachtisch</strong></td>
        </tr>
        <tr valign="top"> 
          <td> <% 
    While ((Repeat1__numRows <> 0) AND (NOT Vorspeise.EOF)) 
    %>
            <input type="radio" name="vorspeise" value="<%=(Vorspeise.Fields.Item("Bild").Value)%>">
            <%=(Vorspeise.Fields.Item("Auswahl").Value)%> <br>
            <% 
      Repeat1__index=Repeat1__index+1
      Repeat1__numRows=Repeat1__numRows-1
      Vorspeise.MoveNext()
    Wend
    %> </td>
          <td> <% 
    While ((Repeat2__numRows <> 0) AND (NOT Hauptgang.EOF)) 
    %>
            <input type="radio" name="Hauptgang" value="<%=(Hauptgang.Fields.Item("Bild").Value)%>">
            <%=(Hauptgang.Fields.Item("Auswahl").Value)%> <br>
            <% 
      Repeat2__index=Repeat2__index+1
      Repeat2__numRows=Repeat2__numRows-1
      Hauptgang.MoveNext()
    Wend
    %> </td>
          <td> <% 
    While ((Repeat3__numRows <> 0) AND (NOT Beilage1.EOF)) 
    %>
            <input type="radio" name="Beilag1" value="<%=(Beilage1.Fields.Item("Bild").Value)%>">
            <%=(Beilage1.Fields.Item("Auswahl").Value)%> <br>
            <% 
      Repeat3__index=Repeat3__index+1
      Repeat3__numRows=Repeat3__numRows-1
      Beilage1.MoveNext()
    Wend
    %> </td>
          <td> <% 
    While ((Repeat4__numRows <> 0) AND (NOT Beilage2.EOF)) 
    %>
            <input type="radio" name="Beilage2" value="<%=(Beilage2.Fields.Item("Bild").Value)%>">
            <%=(Beilage2.Fields.Item("Auswahl").Value)%> <br>
            <% 
      Repeat4__index=Repeat4__index+1
      Repeat4__numRows=Repeat4__numRows-1
      Beilage2.MoveNext()
    Wend
    %> </td>
          <td> <% 
    While ((Repeat5__numRows <> 0) AND (NOT Trinken.EOF)) 
    %>
            <input type="radio" name="Trinken" value="<%=(Trinken.Fields.Item("Bild").Value)%>">
            <%=(Trinken.Fields.Item("Auswahl").Value)%> <br>
            <% 
      Repeat5__index=Repeat5__index+1
      Repeat5__numRows=Repeat5__numRows-1
      Trinken.MoveNext()
    Wend
    %> </td>
          <td> <% 
    While ((Repeat6__numRows <> 0) AND (NOT Nachtisch.EOF)) 
    %>
            <input type="radio" name="Nachtisch" value="<%=(Nachtisch.Fields.Item("Bild").Value)%>">
            <%=(Nachtisch.Fields.Item("Auswahl").Value)%> <br>
            <% 
      Repeat6__index=Repeat6__index+1
      Repeat6__numRows=Repeat6__numRows-1
      Nachtisch.MoveNext()
    Wend
    %> </td>
        </tr>
      </table>
     
      <p></p>
      <p></p>
      
      
    </form>
     
    <table width="600" border="0" align="center" cellpadding="1" cellspacing="1">
      <tr>
        <td>&nbsp;</td>
        <td></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
    </body>
    </html>
    <%
    Beilage1.Close()
    Set Beilage1 = Nothing
    %>
    <%
    Beilage2.Close()
    Set Beilage2 = Nothing
    %>
    <%
    Hauptgang.Close()
    Set Hauptgang = Nothing
    %>
    <%
    Nachtisch.Close()
    Set Nachtisch = Nothing
    %>
    <%
    Trinken.Close()
    Set Trinken = Nothing
    %>
    <%
    Vorspeise.Close()
    Set Vorspeise = Nothing
    %>

    Ich hab (soweit ich das jetzt noch zusammenbekomm ) die Optionsschalter gegen normale Radiobuttons ausgetauscht und mal das 'orderd by' rausgeschmissen zudem hat mir DW (oder doch ich) das ganze mittendrin ein paar mal zerschossen...
    Man merk, dass ich nicht weiß, was ich da tue
     

  6. #6
    Registriert seit
    Aug 2003
    Ort
    Arnsberg, Germany, Germany
    Beiträge
    1.066
    Huhu

    ich glaube nicht, dass Du so ganz verstanden hast, was ich meine.
    Die Radiobuttons bekommen je Abfrage den gleichen Namen. z.B. r0 für die 1. Abfrage, r1 für die 2. Abfrage etc. In der Schleife erhalten Sie aber unterschiedliche Werte. Die o.g. Namenvergabe hat folgenden Grund, lässt man eine Zahl mitlaufen, kann man diese Buttons in einer Zählerschleife besser abfragen.

    Du musst jetzt natürlich noch den Pfad nachtragen

    .write "<td><img src=""pfad/unterpfad/" & stWert & """></td>" & vbcrlf

    Ist der Zähler bei 2 angelangt (0,1,2) macht das Script einen Zeilenumbruch in der Tabelle, so dass Du eine 2 zeilige Tabelle mit je 3 Spalten hast.

    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
    
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <!--#include file="Connections/blubb.asp" -->
    <%
    Dim Beilage1
    Dim Beilage1_numRows
     
    Set Beilage1 = Server.CreateObject("ADODB.Recordset")
    Beilage1.ActiveConnection = MM_blubb_STRING
    Beilage1.Source = "SELECT * FROM Beilage_1"
    Beilage1.CursorType = 0
    Beilage1.CursorLocation = 2
    Beilage1.LockType = 1
    Beilage1.Open()
     
    Beilage1_numRows = 0
    %>
    <%
    Dim Beilage2
    Dim Beilage2_numRows
     
    Set Beilage2 = Server.CreateObject("ADODB.Recordset")
    Beilage2.ActiveConnection = MM_blubb_STRING
    Beilage2.Source = "SELECT * FROM Beilage_2"
    Beilage2.CursorType = 0
    Beilage2.CursorLocation = 2
    Beilage2.LockType = 1
    Beilage2.Open()
     
    Beilage2_numRows = 0
    %>
    <%
    Dim Hauptgang
    Dim Hauptgang_numRows
     
    Set Hauptgang = Server.CreateObject("ADODB.Recordset")
    Hauptgang.ActiveConnection = MM_blubb_STRING
    Hauptgang.Source = "SELECT * FROM Hauptgang"
    Hauptgang.CursorType = 0
    Hauptgang.CursorLocation = 2
    Hauptgang.LockType = 1
    Hauptgang.Open()
     
    Hauptgang_numRows = 0
    %>
    <%
    Dim Nachtisch
    Dim Nachtisch_numRows
     
    Set Nachtisch = Server.CreateObject("ADODB.Recordset")
    Nachtisch.ActiveConnection = MM_blubb_STRING
    Nachtisch.Source = "SELECT * FROM Nachtisch"
    Nachtisch.CursorType = 0
    Nachtisch.CursorLocation = 2
    Nachtisch.LockType = 1
    Nachtisch.Open()
     
    Nachtisch_numRows = 0
    %>
    <%
    Dim Trinken
    Dim Trinken_numRows
     
    Set Trinken = Server.CreateObject("ADODB.Recordset")
    Trinken.ActiveConnection = MM_blubb_STRING
    Trinken.Source = "SELECT * FROM Trinken"
    Trinken.CursorType = 0
    Trinken.CursorLocation = 2
    Trinken.LockType = 1
    Trinken.Open()
     
    Trinken_numRows = 0
    %>
    <%
    Dim Vorspeise
    Dim Vorspeise_numRows
     
    Set Vorspeise = Server.CreateObject("ADODB.Recordset")
    Vorspeise.ActiveConnection = MM_blubb_STRING
    Vorspeise.Source = "SELECT * FROM Vorspeise"
    Vorspeise.CursorType = 0
    Vorspeise.CursorLocation = 2
    Vorspeise.LockType = 1
    Vorspeise.Open()
     
    Vorspeise_numRows = 0
    %>
    <%
    Dim Repeat1__numRows
    Dim Repeat1__index
     
    Repeat1__numRows = -1
    Repeat1__index = 0
    Vorspeise_numRows = Vorspeise_numRows + Repeat1__numRows
    %>
    <%
    Dim Repeat2__numRows
    Dim Repeat2__index
     
    Repeat2__numRows = -1
    Repeat2__index = 0
    Hauptgang_numRows = Hauptgang_numRows + Repeat2__numRows
    %>
    <%
    Dim Repeat3__numRows
    Dim Repeat3__index
     
    Repeat3__numRows = -1
    Repeat3__index = 0
    Beilage1_numRows = Beilage1_numRows + Repeat3__numRows
    %>
    <%
    Dim Repeat4__numRows
    Dim Repeat4__index
     
    Repeat4__numRows = -1
    Repeat4__index = 0
    Beilage2_numRows = Beilage2_numRows + Repeat4__numRows
    %>
    <%
    Dim Repeat5__numRows
    Dim Repeat5__index
     
    Repeat5__numRows = -1
    Repeat5__index = 0
    Trinken_numRows = Trinken_numRows + Repeat5__numRows
    %>
    <%
    Dim Repeat6__numRows
    Dim Repeat6__index
     
    Repeat6__numRows = -1
    Repeat6__index = 0
    Nachtisch_numRows = Nachtisch_numRows + Repeat6__numRows
    %>
    <html>
    <head>
    <title>Unbenanntes Dokument</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
     
    <body>
    <form action="<% = Request.ServerVariables("Script_name")%>" method="post" name="menue" id="menue">
      <table width="900" border="0" align="center" cellpadding="1" cellspacing="1">
        <tr valign="top"> 
          <td><strong>Vorspeise</strong></td>
          <td><strong>Hauptgang</strong></td>
          <td><strong>Beilage 1</strong></td>
          <td><strong>Beilage 2</strong></td>
          <td><strong>Trinken</strong></td>
          <td><strong>Nachtisch</strong></td>
        </tr>
        <tr valign="top"> 
          <td> <% 
    While ((Repeat1__numRows <> 0) AND (NOT Vorspeise.EOF)) 
    %>
            <input type="radio" name="r0" value="<%=(Vorspeise.Fields.Item("Bild").Value)%>">
            <%=(Vorspeise.Fields.Item("Auswahl").Value)%> <br>
            <% 
      Repeat1__index=Repeat1__index+1
      Repeat1__numRows=Repeat1__numRows-1
      Vorspeise.MoveNext()
    Wend
    %> </td>
          <td> <% 
    While ((Repeat2__numRows <> 0) AND (NOT Hauptgang.EOF)) 
    %>
            <input type="radio" name="r1" value="<%=(Hauptgang.Fields.Item("Bild").Value)%>">
            <%=(Hauptgang.Fields.Item("Auswahl").Value)%> <br>
            <% 
      Repeat2__index=Repeat2__index+1
      Repeat2__numRows=Repeat2__numRows-1
      Hauptgang.MoveNext()
    Wend
    %> </td>
          <td> <% 
    While ((Repeat3__numRows <> 0) AND (NOT Beilage1.EOF)) 
    %>
            <input type="radio" name="r2" value="<%=(Beilage1.Fields.Item("Bild").Value)%>">
            <%=(Beilage1.Fields.Item("Auswahl").Value)%> <br>
            <% 
      Repeat3__index=Repeat3__index+1
      Repeat3__numRows=Repeat3__numRows-1
      Beilage1.MoveNext()
    Wend
    %> </td>
          <td> <% 
    While ((Repeat4__numRows <> 0) AND (NOT Beilage2.EOF)) 
    %>
            <input type="radio" name="r3" value="<%=(Beilage2.Fields.Item("Bild").Value)%>">
            <%=(Beilage2.Fields.Item("Auswahl").Value)%> <br>
            <% 
      Repeat4__index=Repeat4__index+1
      Repeat4__numRows=Repeat4__numRows-1
      Beilage2.MoveNext()
    Wend
    %> </td>
          <td> <% 
    While ((Repeat5__numRows <> 0) AND (NOT Trinken.EOF)) 
    %>
            <input type="radio" name="r4" value="<%=(Trinken.Fields.Item("Bild").Value)%>">
            <%=(Trinken.Fields.Item("Auswahl").Value)%> <br>
            <% 
      Repeat5__index=Repeat5__index+1
      Repeat5__numRows=Repeat5__numRows-1
      Trinken.MoveNext()
    Wend
    %> </td>
          <td> <% 
    While ((Repeat6__numRows <> 0) AND (NOT Nachtisch.EOF)) 
    %>
            <input type="radio" name="r5" value="<%=(Nachtisch.Fields.Item("Bild").Value)%>">
            <%=(Nachtisch.Fields.Item("Auswahl").Value)%> <br>
            <% 
      Repeat6__index=Repeat6__index+1
      Repeat6__numRows=Repeat6__numRows-1
      Nachtisch.MoveNext()
    Wend
    %> </td>
        </tr>
      </table>
      <div align="center"><br>
        <input type="submit" name="Submit" value="ausw&auml;hlen">
        <br>
      </div>
    </form>
     
    <div align="center">Ausgabe der Tabelle mit Bildern<br>
      <%
    dim i, stWert
    with response
    .write "<table border><tr>" & vbcrlf
        for i = 0 to 5
        stWert = "standard.gif"
        if Request.Form("r" & i & "") <> "" then
            stWert = Request.Form("r" & i & "")
        end if
            .write "<td><img src=""" & stWert & """></td>" & vbcrlf
            if i = 2 then 
                .write "</tr><tr>" & vbcrlf
            end if
        next
    .write "</tr></table>"
    end with
    %>  
    </div>
    </body>
    </html>
    <%
    Beilage1.Close()
    Set Beilage1 = Nothing
    %>
    <%
    Beilage2.Close()
    Set Beilage2 = Nothing
    %>
    <%
    Hauptgang.Close()
    Set Hauptgang = Nothing
    %>
    <%
    Nachtisch.Close()
    Set Nachtisch = Nothing
    %>
    <%
    Trinken.Close()
    Set Trinken = Nothing
    %>
    <%
    Vorspeise.Close()
    Set Vorspeise = Nothing
    %>
    Geändert von Luzie (03.05.05 um 20:34 Uhr)
     
    liebe Grüße, die Luzie

  7. #7
    Registriert seit
    Apr 2005
    Ort
    Schwabenländle
    Beiträge
    499
    Es klappt
    *rumhüpf* *freu*
    Ich glaub ich werd ASP nie verstehen

    Vielen, vielen Dank

    Dann werd ich mal jetzt versuchen daran weiter zu machen (mit Sicherheitskopie )
     

  8. #8
    Registriert seit
    Apr 2005
    Ort
    Schwabenländle
    Beiträge
    499
    Eine kleine Frage hät ich da noch:
    Wie bekomm ich es hin, dass mir die Seite, nachdem ich 'auswählen' betätigt hab, die ausgewählten Werte stehen lässt? Also die gewählten Buttons also noch aktiv sind?
     

  9. #9
    Registriert seit
    Aug 2003
    Ort
    Arnsberg, Germany, Germany
    Beiträge
    1.066
    Hi

    meines Wissens gibts da im Dreamweaver auch eine Abfrage, in der Art von vergleichen von Werten mit...., ich weiss nicht mehr genau. Wenn Du es findest, solltest Du das nutzen, ansonsten wird bei jedem öffnen der Serververhalten oder dyn. Optionsfelder der eingefügte Scriptcode vom Programm überschrieben. Der kann damit nix anfangen und löscht es raus.

    Wenn Du einmal den Scriptcode manipuliert, darfst Du die entspr. Verhalten nicht mehr nutzen, nur noch im Quellcode arbeiten.

    Das nur als Tipp.

    Du musst einfach den Wert aus dem Request.Form("r x") mit dem Wert aus dem Value vergleichen. Stimmen die überein, dann wird checked geschrieben. Und so gehst Du halt in jeder Deiner Abfragen vor.

    Code :
    1
    2
    3
    
     <input type="radio" name="r2" value="<%=(Beilage1.Fields.Item("Bild").Value)%>"
     <% if Request.Form("r2") = cstr(Beilage1("Bild")) then Response.write "checked"%>>
            <%=(Beilage1.Fields.Item("Auswahl").Value)%> <br>
     
    liebe Grüße, die Luzie

  10. #10
    Registriert seit
    Apr 2005
    Ort
    Schwabenländle
    Beiträge
    499
    Ich glaub ohne dich würd ich hier in 4 Wochen noch wie der Ochse vorm Berg sitzen
    Probier ich gleich noch aus (*auf Uhr schiel* *gleich Feierabend*).

    Danke nochmals
     

Ähnliche Themen

  1. PHP-Anfänger Ausgabe von sql in Textfeldern
    Von Deletemaster im Forum PHP
    Antworten: 3
    Letzter Beitrag: 11.11.07, 23:58
  2. bin am verzweifeln VB6 und Oracle Datenbank *anfänger*
    Von drobskind im Forum Visual Basic 6.0
    Antworten: 2
    Letzter Beitrag: 19.07.06, 22:01
  3. Abfrage und Ausgabe bin am verzweifeln!
    Von kcyberbob im Forum PHP
    Antworten: 3
    Letzter Beitrag: 10.05.05, 22:36
  4. Optionsschalter abfragen
    Von Howie im Forum Javascript & Ajax
    Antworten: 5
    Letzter Beitrag: 18.08.04, 19:06
  5. Poll und Radiobuttons/Optionsschalter
    Von Thanatos im Forum PHP
    Antworten: 2
    Letzter Beitrag: 06.11.02, 14:27