views:

191

answers:

1

Hi People,

The problem if someone types into the search box a location it goes through to that location page but if they type in a location thats not found or they dont type anything in I need it to redirect back to the homepage (index.asp) and display "whoops we couldnt find that" in the search box (input field)

This is the vb

    Case Else
    response.redirect "index.asp?whoops=whoops we couldnt find that"
End Select

Then in the value of the input field I have

value="<% =whoops %>"

This doesnt work by the way, first is this the best way of doing it because id rather not have the error message in the url. This there away of posting the error as a variable and then calling it into the input field like,

<% =whoops %>
A: 

You don't need the error message in the url. Also, whoops won't be available to you as a variable just because it is in the url. You have to look for it in the Request.Querystring collection. What you'd want to do is something more like this on the homepage:

Dim whoops : whoops = ""
If Request.Querystring("whoops") Then
    whoops = "whoops we couldnt find that"
End If

Then you could output <%=whoops %> as the search box's HTML value attribute. This would also prevent people from being able to assign whatever they want to the value of whoops, which is a security vulnerability.

Tom