[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference terri::web_authoring

Title:Welcome to WEB_AUTHORING
Notice:Before writing, please check for an existing topic
Moderator:VAXCAT::LAURIE
Created:Tue Mar 05 1996
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:186
Total number of notes:1479

181.0. "How to import HTML variable in csh cgi script ?" by BALZAC::DAKONO (The thirdy thirth VIP station) Wed May 07 1997 22:16

    Hi,
    
    
    	I am building a WEB server using Netscape Enterprise Server on
    Unix.
    	I have question, how to access from CGI scipts written in csh
    the variable from my HTLM form.
    	I try to use directly variable name like $username (if my form
    contains a field named username) but it does not work.
    
    	What is the good way to do it ?
    
    Regards
    
    	Jerome Dakono Digital France
    
T.RTitleUserPersonal
Name
DateLines
181.1http://hoohoo.ncsa.uiuc.edu/cgi/overview.html45862::16.194.64.204::watsonOK, whats todays long term strategy?Thu May 08 1997 11:1351
The form data will be passed across in the environment variable $QUERY_STRING

in the form var1=value1&var2=value2 etc.

the values will be escaped so that space turns in + and other characters into 
a hex represnetation, so these will need to be decoded. There are routines 
avaialble to do this in many languages, including sed scripts which you can 
call from the shell.

check out http://hoohoo.ncsa.uiuc.edu/cgi/overview.html for the gory details.

You might like to use the following script to experiment with:

#!/bin/sh

echo Content-type: text/plain
echo

echo CGI/1.0 test script report:
echo

echo argc is $#. argv is "$*".
echo Working directory:
pwd


echo SERVER_SOFTWARE = $SERVER_SOFTWARE
echo SERVER_NAME = $SERVER_NAME
echo GATEWAY_INTERFACE = $GATEWAY_INTERFACE
echo SERVER_PROTOCOL = $SERVER_PROTOCOL
echo SERVER_PORT = $SERVER_PORT
echo REQUEST_METHOD = $REQUEST_METHOD
echo HTTP_ACCEPT = "$HTTP_ACCEPT"
echo PATH_INFO = $PATH_INFO
echo PATH_TRANSLATED = $PATH_TRANSLATED
echo SCRIPT_NAME = $SCRIPT_NAME
echo QUERY_STRING = $QUERY_STRING
echo REMOTE_HOST = $REMOTE_HOST
echo REMOTE_ADDR = $REMOTE_ADDR
echo REMOTE_USER = $REMOTE_USER
echo CONTENT_TYPE = $CONTENT_TYPE
echo CONTENT_LENGTH = $CONTENT_LENGTH
echo HTTP_REFERER = $HTTP_REFERER
echo HTTP_FROM = $HTTP_FROM
echo HTTP_USER_AGENT = $HTTP_USER_AGENT


echo STANDARD INPUT FOLLOWS
cat
echo END OF STANDARD INPUT

181.2Try uncgiENGPTR::MCMAHONThu May 08 1997 19:5619
    I would suggest that you get a copy of 'uncgi' (freeware) and have your
    forms feed their input through this. It takes all the fields on your
    form and makes them environment variables. In your shell script, you
    then work with these environment variables. I use this for all my forms
    and it works great.
    
    For example, if your form had this action: "/cgi/formserv.csh" it just
    becomes "/cgi/uncgi/formserv.csh".
    If your form has a field called 'first_name', uncgi takes the value
    from this and puts it into an environment variable called
    '$WWW_first_name' which you can manipulate in your shell script.
    
    The most recent version of the uncgi software, is available via the 
    World-Wide Web at http://www.hyperion.com/~koreth/uncgi.html.
    
    I can send you the README file if you're interested.
    
    /pat