SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    using a wildcard in an if else statement

    Hi,
    In an ecommerce situation, when a category link is clicked, my results page shows the category name at the top of the page

    This is working great apart from when a search is done without specifying category eg from the search page

    So for example Results.asp?Category=%25&Keyword=&Submit=Search

    This gives all products in the results page but just gives the last category name in the table as the heading

    I would like to write a condition that just presents a static message eg ‘Results’ when the search wildcard % is passed

    I have tried with


    <% if rsCatName.Fields.Item("Category") = "%" then %> <h2>Results</h2>
    <% else %>
    <h2><%=(rsCatName.Fields.Item("Category").Value)%></h2>
    <% end if %>

    but this does not work
    Can someone tell me how to do this correctly please

    Thanks

    ian

  2. #2
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if instr(request.querystring("Category"),"%") > 0 then

    the instr (in string) will tell you if the % is in the querystring variable...


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
  •