WebBasic Interpreter

WebBasic is a BASIC lanquage interpreter that makes it extremely easy to do server-side web programming. Here is the WebBasic Language Reference Manual for the WebBasic language. It is a BASIC language interpreter similar to QBasic and QuickBasic. It has been developed from the ground up to support server-side Web programming. It easily interacts with Web forms. Input fields from web forms, the URL query string, URL path information, and all CGI environment variables are automatically defined as a WebBasic variable. File upload support is automatically handled also, and variables are defined to identify the new filename and the browser side filename. The graphics commands of BASIC are supported and are used to output GIF files. The latest release for Windows supports database access via ODBC and a built-in database and SQL commands.

NOTE - This product has been sold and is no longer available for download!

You may also create files that are a mixture of HTML and BASIC, similar to Microsoft's ASP. This new product is called HTMLBasic, and it is automatically included with WebBasic. Here is an example:

<% for j = 1 to 5 %>
  I Love Number: <%=j%> <BR>
<% next %>

NOTE - We lost our CGI Web Hosting! Examples no longer work here, but you may download the executables below

Download version 2.0 for Windows 95/98/NT/XP and Linux
Installation Instructions

What's New
Sep 1, 2007 - Integrated SQL language and database via Sqlite.
Aug 17, 2001 - Sun OS version for Unix now available.
July 7, 2001 - added more FILE commands FileIsExecutable and FileIsFolder and FileIsLegal and FileIsProgram and FileIsReadable and FileIsWriteable.
Fixed a bug in the FILES command.

Mar 27, 2001 - added HTTP comands HTTPGET and HTTPPOST
Aug 22, 2000 - added support for FreeBSD operating system.
July 23, 2000 - added (still some bugs though) LOF function and LOCKing statements
July 1, 2000 - added SELECT CASE statement and DO ... LOOP statement
June 6, 2000 - added FileExists and FileTimeStamp commands.
May 10, 2000 - SQL/ODBC enhancements.
Mar 31, 2000 - Minor Graphics commands enhancements: support of transparent backgrounds, writing text down, up, backwards. new COLOR, LOCATE commands. See graphics commands in documentation.
Mar 23, 2000 - Support for READ, DATA, and RESTORE commands.
Oct 4, 1999 - New initialization file read on startup.
See Initialization File in documentation.
Sep 27, 1999 - New commands and functions.
EMAIL command added. Email form data or whatever to whomever. Support for attachments also.
New directory commands:, MKDIR, RMDIR, CHDIR, and FILES.
New string function: MATCH This function provides for regular expression pattern matching.
SIMILAR This function compares two strings for similarity.
May 22, 1999 - Database access through ODBC using SQL. For Window's version only, access industry standard databases such as Microsoft Access, Oracle, Microsoft SQL Server, etc..
Mar 19, 1999 - HTMLBasic added.
File Upload implemented via type=file from browser. Automatic support for file uploads of text and binary files, multiple files per upload also. THIS IS THE EASIEST WAY TO UPLOAD DATA ON THE WEB!

We have working examples of

We have source code only examples of

Other examples follow.
Here is a program written in WebBasic that prints Hello World 10 times. Click here to run the program.

rem The next line is needed, it writes the content header!
for j = 1 to 10
print "Hello World<br>"

Example 1: Use of web forms
The next 2 lines show a Web form with an input field named myname. WebBasic creates a variable named myname and assigned the value you enter to this variable. Remember that the same WebBasic variable holds both string and numeric values, so myname$ refers to the string value, and myname refers to the numeric value (0 of nonnumeric string). If you had a variable named loanamt, use loanamt for the numeric value, and loanamt$ for the string value.
<form method=get action=cgibas.exe/exname.b>
Enter your name: <input type=text name=myname size=30 maxlength=30>

Try it out here:

Enter your name:
See the source code for the above example.

Example 2: Jump to a home page
The next 2 lines show a Web form with an input field named url that accepts a home page URL and uses a CGI Location Header to jump to that page.
<form method=get action=cgibas.exe/exjump.b>
Enter a home page: <input type=text name=url size=50 maxlength=100>
Enter a home page:
See the source code for the above example.

Example 3: Here is a graphics demostration. Enter a draw string below and Click on the button. See DRAW COMMAND for help.
Image Width Image Height
Enter a draw string:
See the source code for the above example.

Example 4: A generic program to email form data.
Simply specify this program as the ACTION url in the FORM tag (ie. form action=/cgi-bin/cgibasic.exe/mailform.b)
REM  mailform.b - Generic mail form results to someone
mailfrom$ = "baileyd@ddginc-usa.com"
mailto$ = "info@ddginc-usa.com"
email from mailfrom$ via "12.34.567.890"
while (formfield_name$(j) <> "") AND (j < 100)
   body$ = body$ + formfield_name$(j)+" : " + formfield_value$(j)+chr$(13)+chr$(10)
email to mailto$ subject "form submission" body$
? "Results Mailed, Thanks"

WebBasic programs are plain text programs that may be created using any text editor. The files are saved with an extension of b. Ex. myprog.b. CGI programs must supply a valid Content Type. Typically, this is as simple as starting the first line of the program with:

Other content types are supported simply by using the print command. Example:
print "Content-type: text/plain"

Installation Instructions

WebBasic runs as a CGI program, which means it runs on the same computer as your Web Server. I run the program under Windows 95 at my office, and Linux on my ISP's computer. The examples you see on this page comes from my ISP's computer. The easiest way of working with WebBasic is too run it locally under Windows. If you have a web server from Microsoft, WebBasic will work with it. If you don't have a Web Server, go to iMATIX and download their free XITAMI Web Server for Windows 95/NT. After it is installed, you will see a directory \xitami\cgi-bin. Copy cgibasic.exe to this directory. If using Linux, make sure the cgibasic.cgi filename is lowercase. Also place your WebBasic scripts in this directory( ex. testit.b ). To run this script, reference the URL in Netscape as The refers to your local computer, cgi-bin is the directory where cgibasic.exe is located, testit.b is the name of the script you want to execute. The program locates and executes the script based on the file name after cgibasic.exe/ in the URL. If you are using Linux, copy cgibasic.cgi into the cgi-bin directory or whatever directory you web server uses to execute CGI programs. The WebBasic program should also be in this same directory, unless specified differently in the initialization file. To test programs from the command line (c:\ prompt), execute the program as cgibasic.exe -f script.b where script.b is the filename of your program.

Versions are available for Windows 95/NT and Linux. SCO Unix no longer supported but older version exists. Other Unix versions are available on request. You are encouraged to download the current version and try it out. For more information email ddgflorida@yahoo.com or call (850) 671-7845

General purpose C library (SFL) from www.imatix.com.

© 1998 Data Design Group, Inc. All Rights Reserved