Euphoria CGI Interface
Problem solved: Here's what works for me.
First: a simple form to post:
-------------------------------------
<HEAD><TITLE>CGI Demo</TITLE></HEAD>
<HR>HELLO
<P><FORM METHOD="POST"
ACTION="../cgi-dos/cmd.bat">
<P><B>Employee Locator</B>
rch on <SELECT NAME="what">
<OPTION SELECTED>Name
<OPTION>Title
<OPTION>Department
<OPTION>Location
</SELECT>
<P>which <SELECT NAME="how">
<OPTION SELECTED>starts with
<OPTION>contains
<OPTION>is exactly
<OPTION>sounds like
</SELECT>
<P>the following: <INPUT TYPE="text" NAME="value"><P>
<INPUT TYPE="checkbox" NAME="usecase" VALUE="yes">Case-sensitive<P>
<INPUT TYPE="submit" VALUE="Start Search">
</FORM>
<HR>
-------------------------------------------------------------
Now, a bat file to call the Eu program:
(This is cmd.bat)
rem pause to debug
ex c:/httpd/cgi-dos/cmd.ex %output_file% %CONTENT_FILE%
rem pause to debug
-----------------------------------------------------
Last, the Euphoria code: (cmd.ex)
-- Euphoria CGI
include get.e -- for waitkey pause while debugging
object cmdline, data, fn
data = ""
cmdline = command_line()
fn = open(cmdline[4],"r") -- read in the data stored in a temp file
if fn > 0 then -- by the server.
data = gets(fn)
close(fn)
end if
puts(1,data)
fn = open(cmdline[3],"w") -- The output filename
if fn > 0 then -- is read by the server
puts(1,"Writing output to:"&cmdline[3]&"\n") -- debug
-- use the following line for plain text
-- and remove all the html stuff
-- puts(fn,"Content-type:text/plain\n")
puts(fn,"Content-type:text/html\n")
puts(fn,"\n")
puts(fn,"<HTML><HEAD><TITLE>")
puts(fn,"Euphoria CGI Results")
puts(fn,"</TITLE></HEAD><BODY>")
puts(fn,"<H1>Euphoria sez</H1>\n")
puts(fn,"Your form data:")
puts(fn,"<H5>")
puts(fn,data)
close(fn)
end if
-- uncomment wait to debug
--fn = wait_key()
-------------------------------------------------
Naturally, you can make the euphoria code do whatever
you want, and return either plain text or a full html page.
Whew!
Irv
------------------------------------------------------
Visit my Euphoria programming web site:
http://www.mindspring.com/~mountains
------------------------------------------------------
|
Not Categorized, Please Help
|
|