• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

check if variable is set

I'm working on something which I am sure is very simple to do in asp but as I'm a php person I'm a bit stuck.

I've got most of what I need but I have to get the script working so that a form's action is the existing page when the submit button is pressed.

In php I would use if (isset ($var)){ } but what is the equivalent in php?
  • 2
1 Solution
Forgive me if I'm misunderstanding you here but I assume that you mean the current page is "default.asp" & you're form is posting to "default.asp". If that's the case then try this.....

  ' Check if variable has been set
  If isNull(request.form("var")) OR request.form("var") = ""  THEN
     ' Variable has not been set or is an empty string
  End If

Hope that helps

richardwhitAuthor Commented:
Yep that looks like it might be what I'm looking for. Sorry my question wasn't very well worded, thats what staring at a computer screen for too long does to you!
lol - yep i know exactly what you mean
Here is somthing i like to do when i am posting to teh same site since all the vars will be null before you post...

submit = request.form("Submit")
Var1 = Request.form("Var1")

If Submit = "submit" then
     'then do all other code
end if
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now