#!/bin/sh

if [ $REQUEST_METHOD="POST" ]; then
   read WHAT_THEY_SENT            #Use the POST variables from StdIn
else
   WHAT_THEY_SENT=$QUERY_STRING   #Use the GET variables which show up in $QUERY_STRING
fi



#Parse the variables they sent us
#This is dangerous, it could knock out an existing variable!
for VAR in `echo $WHAT_THEY_SENT | tr "&" "\t"`                  #Split the string on the & character
   do
   NAME=$(echo $VAR | tr = " " | awk '{print $1}';);             #name of the variable
   VALUE=$(echo $VAR | tr = " " | awk '{ print $2}' | tr + " "); #Value of the variable
   export $NAME="$VALUE";                                        #Create the variable in the script
done

#Tell the browser it's html we're going to send
#Then leave a blank line (to separate Headers from Content
#Then start the HTML document
echo "Content-type: text/html; charset=iso-8859-1"
echo ""
echo "<html><body> <h1> Hi there </h1>"

