323
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
Working with HTTP Variables
HTML pages often pass "variables" to each other. For example, if you have an
HTML form to fill on page "form.html" you may want to have the data input by the
user on page "result.html".
The explanation of HTTP variables is divided into three sections:
-- the amount of HTTP variable data does not exceed 255 bytes;
-- the amount of HTTP variable data exceeds 255 bytes (can
easily happen, especially with file uploads);
on how the variable data actually looks to your application depending
on the method used (HTTP GET or POST).
In most cases the client will send a fairly small amount of variable data, so it all
will fit in 255 bytes. Use the
R/O property, as shown in the
following example. Say, you have a login to perform. The user enters his/her name
and password on page "index.html". Actual login is processed on page "login.
html". The data is passed between these two pages "invisibly", using the HTTP
POST method.
Here is the file "index.html":
<html> <body>
<form action="form_get.html" method="post"
enctype="multipart/form-data">
username: <
Input
Type
="text" name="user"><br>
password: <
Input
Type
="password" name="pwd"><br>
<
Input
Type
="submit" value="send">
</form>
</body> </html>
And here is "login.html":
<html><body>
<?
dim
s
as
string
s=sock.httprqstring
'actual processing here, s now contains the variable string
?>
</body></html>
explains what exactly you get from the
property.
The advantage of using the sock.httprqstring is that the variable data is always
there, no matter how many times you read it. Be forewarned, though...
If you are using the sock.httprqstring, and if the client sends more data
than can fit in the VAR buffer, the execution of the HTTP request
processing will be stalled indefinitely. See
for a method of handling this correctly.
323
324
326
336
326
336
324