Solved

check if variable is set

Posted on 2004-09-21
4
207 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
WhisperUK earned 125 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Query not working correctly? (or how i want it to... 6 54
Questions about INCLUDE FILES 2 43
ASP/VB email question 4 63
ASP and Extracting XML 7 31
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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…

730 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