Function GetParamStr()
For wcBASIC, data is sent two different ways, from a FORM method="GET" and FORM method="POST"
The easiest way to remember this is that a GET sends the form data on the URL line and POST sends it as a FILE to wcBASIC.
As of 449.5, I made it simply so it is doesn't matter:
Here is an example code:
#include <htmlutil.wch>
// // Read the data send by the browser. // PrepareHTTPRequestData will check for GET and POST methods
// PrepareHTTPRequestData will return TRUE if a POST method was used //
dim nvpairs as string PrepareHTTPRequestData(paramstr(1), nvpairs)
// nvpairs string is the "name=value" pairs in the form data, // so if you are looking for a input field, use
// the GetParamXXXr() functions to extract the Name/Value Pairs
dim email as string = GetParamstr(nvpairs,"email")
dim name as string = GetParamstr(nvpairs,"name") dim age as string = GetParamInt(nvpairs,"age")
|
NOTE:
If you don't have 449.5, then simply use GetParamStr(Paramstr(1)) for a GET method or GetParamStr(GetPostData(Paramstr(1))) for a POST method. The PrepareHTTPRequestData
basically does this for you.
The only things is this. If you are UPLOADING a FILE, the file data is not part of the nvpairs! See the Developer's corner for an example of how to upload a file using POST
© 2002 Hector Santos, http://www.santronics.com
|