?
Solved

check if variable is set

Posted on 2004-09-21
4
Medium Priority
?
216 Views
Last Modified: 2008-01-09
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?
0
Comment
Question by:richardwhit
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
WhisperUK earned 375 total points
ID: 12110681
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

0
 

Author Comment

by:richardwhit
ID: 12110706
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!
0
 
LVL 3

Expert Comment

by:WhisperUK
ID: 12110718
lol - yep i know exactly what you mean
0
 
LVL 7

Expert Comment

by:kmorris1186
ID: 12112396
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
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Integration Management Part 2
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question