|
Post by turbov21 on Oct 17, 2007 20:03:19 GMT -5
A simple, basic function designed for grabbing values from the UrlKey$ string based on a key (key$). It's not fully complete, because I've still got to finish my URI decoder function for standing symbols like %20 into spaces and such, at which point I'll put it on the wiki. Here it is in action.' Grabs a value from the url function GetVal$(string$, key$) value$ = "" key$ = key$ + "=" startit = instr(string$, key$)
if startit > 0 then startit = startit + len(key$)
endit = instr(string$, "&", startit)
if endit > 0 then endit = endit - startit value$ = mid$(string$, startit, endit) else value$ = mid$(string$, startit, len(string$)) end if end if GetVal$ = value$ end function |
|
|
Chris Iverson
Junior Member
There are many worlds, but they all share the same sky. One sky, one destiny.
Posts: 73
|
Post by Chris Iverson on Oct 21, 2007 19:41:21 GMT -5
Nice. I was planning on doing something similar, only using the rbHash program Jerry came up with to throw it into an associative array, sort of like what PHP does with $_POST[], $_GET[], and $_REQUEST[](is it request? the one with both POST and GET data?)
|
|
|
Post by kaalidor on Feb 4, 2008 17:54:08 GMT -5
where can we find rbHash ?
regards,
pascal
|
|
|
Post by Alyce on Feb 4, 2008 18:02:56 GMT -5
|
|
|
Post by kaalidor on Feb 11, 2008 15:58:02 GMT -5
Thank's Alyce,
|
|
|
Post by Psycho on May 22, 2010 21:22:47 GMT -5
Here's an expansion to turbov21's earlier post including removal of "%20" and replacement with spaces. 'normally you would just use UrlKeys$ in place of this$ this$="DieDisplayAdd$&dienum=this%2012345&name=John%20Doe"
'print GetVal$(UrlKeys$,"whatever") print GetVal$(this$,"dienum") print GetVal$(this$,"name") end
' Grabs a value from the url function GetVal$(string$, key$) value$ = "" key$ = key$ + "=" startit = instr(string$, key$) if startit > 0 then startit = startit + len(key$) endit = instr(string$, "&", startit) if endit > 0 then endit = endit - startit value$ = mid$(string$, startit, endit) else value$ = mid$(string$, startit, len(string$)) end if end if for x = 1 to len(value$) if mid$(value$,x,3)="%20" then spaces=spaces+1 next x for x = 1 to spaces+1 newWordToPass$=newWordToPass$+word$(value$,x,"%20") 'add space if we aren't at the end of the string if x<spaces+1 then newWordToPass$=newWordToPass$+" " next x GetVal$ = newWordToPass$ end function John "Psycho" Siejkowski
|
|