Question on Value?

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/67340?pagenum=1
05 November 2025, 14:46

Topic


JJenson
Question on Value?
24 June 2008, 19:11


Ok so I have a form that is pulling in through a quearystring a value for a field. This is what I have for it:

This is the code to get the referer

Code:

<%

Dim Referer : Referer = Request.ServerVariables("HTTP_REFERER")
Dim Location

Select Case(InStr(Referer, "http://www.jiffylube") > 0)
Case True: Location = Mid(Referer, 21, InStr(21, Referer, ".") - 21)
Case Else:
End Select

%>


<input type="text" value="<%=Location%>" size="20" name="Location" readonly />

What I need to modify this is basically say if location=nothing then show na

I just can't get it right.<

 

Replies ...


JJenson
24 June 2008, 22:42


Any Ideas? <
phy1729
24 June 2008, 22:51


Did you try If location = "" then location="na" end if? Also if there's no reason to use a select case consider using an if then. I cringed.<
AnonJr
25 June 2008, 07:18


Originally posted by phy1729
Also if there's no reason to use a select case consider using an if then. I cringed.
Sure there is - if you know that there's going to be a need to add more later on, a Select Case tends to be a little more readable than an endless ElseIf chain. (Your preferences may vary.)

Even if there isn't, I find what he's doing to be much more readable - and therefore maintainable - than some of the convoluted If .. Then bits I've seen floating around. More and more I'm coming to the conclusion that there's a fool's economy in sacrificing maintainability in the name of machine performance. Hardware is cheap, programmer time isn't.<
gary b
25 June 2008, 12:23


Originally posted by JJenson Dim Referer : Referer = Request.ServerVariables("HTTP_REFERER")
Dim Location

Select Case(InStr(Referer, "http://www.jiffylube") > 0)
Case True: Location = Mid(Referer, 21, InStr(21, Referer, ".") - 21)
Case Else:
End Select

What I need to modify this is basically say if location=nothing then show na

JJ... My usual disclaimer: I only sometimes have a clue about what you want to know!
Why not intercept the process? Once you populate Referer, test it. IF Referer="" THEN
Location = NA
ELSE
'Do nothing
ENDIF

Obviously, remainder of code would have to match this approach. My point is that you are focusing on Location when, I believe, your focus should be on Referer.
Any merit in this idea?
gary b
<
JJenson
25 June 2008, 14:30


Well in the end they told me its ok to leave it as they though someone could delete the number if it was populated. But I told them it is not possible as it is a read only field they think they are getting this error through another form. So I guess in the end I didn't need it lol.
But I can see where you are going with it Gary I believe it would work but no longer need it thanks though.<
© 2000-2021 Snitz™ Communications