PDA

View Full Version : how to break data passed in a parameter (url passing)?


arbil
06-09-2003, 12:38 AM
a message is passed in a parameter like this:
sample.asp?message=exmloc 03123451 simon/johnson/edwards

how do I break the messages and pass to the ff variables according to this order:
service=exmloc
serv_code=03123451
fullname=edwards/johnson/simon
last=edwards
middle=johnson
first=simon

i need to break the fullname into last, middle and first so that I could query it in the database which contains those fields.
Any help me with these? Thanks a lot guys....
;)

amir
06-09-2003, 10:40 AM
<%
fullname="edwards/johnson/simon"
myarray = split(fullname,"/")
name = myarray(0)
middle_name = myarray(1)
last_name = myarray(2)
%>

af11k
06-09-2003, 01:30 PM
<%
Dim myStr, service, serv_code, fullname, last, middle, first
Dim spc1, spc2, slash1, slash2
Dim esp

esp = "<br>"
myStr = Trim(Request.QueryString("message"))
Response.Write(myStr & esp)
spc1 = InStr(1, myStr, " ")
spc2 = InStr(spc1 + 1, myStr, " ")
service = Mid(myStr, 1, spc1 - 1)
Response.Write("service=" & service & esp)
serv_code = Mid(myStr, spc1 + 1, spc2 - spc1 - 1)
Response.Write("serv_code=" & serv_code & esp)
slash1 = InStr(spc2 + 1, myStr, "/")
first = Mid(myStr, spc2 + 1, slash1 - spc2 - 1)
Response.Write("first=" & first & esp)
slash2 = InStr(slash1 + 1, myStr, "/")
middle = Mid(myStr, slash1 + 1, slash2 - slash1 - 1)
Response.Write("middle=" & middle & esp)
last = Mid(myStr, slash2 + 1, Len(myStr) - slash2)
Response.Write("last=" & last & esp)
fullname = last & "/" & middle & "/" & first
Response.Write("fullname=" & fullname & esp)
%>

arbil
06-09-2003, 08:20 PM
thanks a lot guys..... I thought I wont get any anwers...dis board is cool...:eek2: