Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Mar 2002
    Location
    Haaltert, Belgium
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts

    problems with if else statement

    Edited by Leif to replace <!t>[script] tags with <!t>[code] tags to make it more legible!


    I'm trying to capture an array in fields.
    i have 3 file fields in my form.
    When I for exemple select a file in the second formfield in my array it is numbered as 1.
    I wan't that it is numbered as 2.
    i have tried this:
    <code>if naamvanfile(1) like "file1%" or naamvanfile(2) like "file1%" or naamvanfile(3) like "file1%" then
    image1 = naamvanfile(1)
    else if naamvanfile(1) like "file2%" or naamvanfile(2) like "file2%" or naamvanfile(3) like "file2%" then
    image2 = naamvanfile(1)
    else if naamvanfile(1) like "file3%" or naamvanfile(2) like "file3%" or naamvanfile(3) like "file3%" then
    image3 = naamvanfile(1)
    end if
    end if
    end if</code>


    But it only looks at my first "if".
    Can somenone help me with this please?

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: problems with if else statement

    I don't fully understand the context or the problem. <img src=/S/sad.gif border=0 alt=sad width=15 height=15>

    For context, can you post the HTML part of this puzzle? You can zip the page and attach it to a reply. (You can't attach an HTML file directly to a post here.)

    Regarding the problem, perhaps you want to use three separate If... Then... End If structures, without the alternate Else clauses? (The Else clauses will only be followed if the earlier comparison fails.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •