Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

default variable

Status
Not open for further replies.

vlitim

Programmer
Sep 2, 2000
393
GB
How can you assign a value to a variable as a default. ie if the variable name is not passed to the page it is set to a default value, but if the variable is passed to the page then it stays as the value passed!?

cheers
 
Are you talking about form variables???

If so, the default value for any form variable (unless you or the user specify otherwise) is "" -- empty string.

 
no I have a page with a case statement on it, and as a default I want it to execute step 1. It is ok when I call via a string ie default.asp?step=1, but I want it to default to step 1 if someone types just default.asp!
 
Code:
if request.queryString("step") = "" then
    step = 1
else
    step = request.queryString("step")
end if

Then, just check your case against step...

hope it helps! :)
Paul Prewett
 

excellent thanks for that! Just what I wanted
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top