SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2002
    Location
    South-West UK
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    If Else Help needed (again)

    Hello again guys,

    Wondered if anyone could help me out with a simple If Else statement I'm doing at the moment.

    It's for a kinda check page before the info is entered into a database.

    The input form has a few checkboxes which have a checked value of 1.

    I'm able to get the check page to display a number 1 next to the corresponding field name if the checkbox was ticked, but I'd rather show an image of a small tick or something.

    This is how I'm trying to diplay an image if the checkbox on the previous page was ticked:

    ------------------------------------

    <% If ("general") <> True Then %><img src='images/dot.jpg' border=o><% End If %>

    -------------------------------------------

    Anyone any ideas on what I'm doing wrong?

    Matt

  2. #2
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:
    [vbs]
    <%
    If ( NOT Request.Form("general") ) Then
    Response.Write("<img src='images/dot.jpg' border=0>")
    End If
    %>
    [/vbs]

  3. #3
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,290
    Mentioned
    122 Post(s)
    Tagged
    1 Thread(s)
    Or if general is a local variable that you copied the form value into, then your code should look like this:

    Code:
    if general <> true then
       Response.Write "<img src=""images/dot.jpg"" border=""0"">"
    end if
    Just a side note, if you were using the exact code you posted, you have a border of o(the letter) instead of 0(the number). Could be part of your problem too...
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse

  4. #4
    SitePoint Zealot
    Join Date
    Jul 2002
    Location
    South-West UK
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That didn't work....thanx for ur help anyway.

    I forgot to say that I'm declaring my variables at the top of the page by using:

    [VBS]<%
    Dim general,

    general = Request.form( "general" )


    %>
    [/VBS]

    Didn't know whether that would make a difference?

    Matt

  5. #5
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,290
    Mentioned
    122 Post(s)
    Tagged
    1 Thread(s)
    I just noticed the checked value of 1 in your first post. Change my code to if general <> 1 then and it should work...
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse

  6. #6
    SitePoint Zealot
    Join Date
    Jul 2002
    Location
    South-West UK
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your help Davemaxwell....works fine now....cheers.

    I had to make a further alteration as it was working back to front so I altered the .. <> True

    to read

    = 1

    Cheers once again

    Matt


Bookmarks

Posting Permissions

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