Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 Question on Value?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

JJenson
Advanced Member

USA
2121 Posts

Posted - 24 June 2008 :  19:11:44  Show Profile  Visit JJenson's Homepage  Reply with Quote
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


<%

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.<

Edited by - JJenson on 24 June 2008 19:13:10

JJenson
Advanced Member

USA
2121 Posts

Posted - 24 June 2008 :  22:42:06  Show Profile  Visit JJenson's Homepage  Reply with Quote
Any Ideas?
<
Go to Top of Page

phy1729
Average Member

USA
589 Posts

Posted - 24 June 2008 :  22:51:57  Show Profile  Reply with Quote
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.<
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 25 June 2008 :  07:18:51  Show Profile  Visit AnonJr's Homepage  Reply with Quote
quote:
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.<
Go to Top of Page

gary b
Junior Member

USA
267 Posts

Posted - 25 June 2008 :  12:23:10  Show Profile  Visit gary b's Homepage  Reply with Quote
quote:
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
<
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 25 June 2008 :  14:30:58  Show Profile  Visit JJenson's Homepage  Reply with Quote
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.<
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000 Version 3.4.07