running shell script thru WEB page ....

....passing variable via list...

here 's the HTML code extract :

                         \****************

<form method=post action=http://servername/cgi-bin/cgi-comptage_diff.ksh>
<table border...........>
.............. </table>
<table bgcolor=#FFFFFF width="980">
<td align=center width="250" bgcolor="#FFFFFF" height="90" bordercolor="#339933">
<select size=20 name=TOTO>
<option>APP101</option>
<option>APP102</option>>
.....
******************

whether i select APP101 or APP102 , i send "TOTO=APP101" when i only need "APP101" and second behind "APP101" , i catch a DOS carriage return that i don't need.

I'm running shell AIX.

Somebody can help me ?

thanks in advance

Christian

I don't fully understand what you want.

Using the following html code (note - i'm using GET here instead of POST)

<html><head></head><body>
<form method="get" action="http://localhost/cgi-bin/foo.ksh">
<select size="20" name="TOTO">
<option>APP101</option>
<option>APP102</option>
<option>APP103</option>
<option>APP104</option>
</select>
<input type="submit">
</form>
</body></html>

and the following basic shell script

#!/bin/ksh

echo -e "Content-type: text/html\n\n"
echo "<html><head></head><body>"
echo $QUERY_STRING
echo "</body></html>"

exit 0

The correct value of "TOTO" gets passed across (e.g. TOTO=APP103, or whatever). Is this what you want? You can always then use sed, tr, cut and other tools to get the output as you want it. Just use '=' as the delimeter and take the first field.

I'd seriously consider writing the cgi in Perl anyway

Cheers
ZB

Thanks for your help ,

YES it is what i want except that the information received in
QUERY_STRING is DOS format:

TOTO=APP101 is in reality : TOTO=APP101^M
when i use in vi.

Confirmed with the following script , i got 7 characters when i display the variable APP204

******************************
echo -e "Content-type: text/html\n\n"
echo "<html><head></head><body>"
echo $QUERY_STRING

typeset -R6 QUERY_STRING
echo $QUERY_STRING
echo $QUERY_STRING|wc -m
typeset -L6 QUERY_STRING
echo $QUERY_STRING
echo $QUERY_STRING|wc -m

echo "</body></html>"

exit 0
********************************
the problem is that i want to add a value to APP101 like APP101A ,

how can i delete the "^M" DOS carriage return ?

thanks
Christian

Pipe QUERY_STRING through tr to remove the carriage return character ( ASCII octal 015)

e.g.

NO_CR=`echo $QUERY_STRING | tr -d '\015'`

Cheers
ZB

thanks for your help ,

to sum up :

if we use <form method="get" ....
...we pass QUERY_STRING variable in the good format ("TOTO=APP101")

in the shell script if we try to read the input variable :

read TOTO

we got nothing

but...
...if we use <form method="post" ....
...we pass nothing in QUERY_STRING variable

and in the shell script if we try to read the input variable :

read TOTO

we got "TOTO=APP101^M"

....for sure we will use the first solution with "get" and the QUERY_STRING !!

thanks again i get the solution and i understand it !!

Christian

...the "return" of the carriage return........................

......running the shell script on AIX , ksh is treating
2 files like that :

diff $fic_tmp2 $fic_tmp4 > $fic_tmp5 2> /dev/null
echo "$(cat $fic_tmp5|grep \> |sed -e 's/\>//g')"

and got :

name1
name2
name3.........

but when running from the WEB :

the result is :

name1name2name3

Question :

how can i treat $fic_tmp5 to have the same display on the WEB ?

i hope that this time the "^M" is missing !!!!! maybe SED but i'm still searching !!!!

Christian

...the "return" of the carriage return........................

......running the shell script on AIX , ksh is treating
2 files like that :

diff $fic_tmp2 $fic_tmp4 > $fic_tmp5 2> /dev/null
echo "$(cat $fic_tmp5|grep \> |sed -e 's/\>//g')"

and got :

name1
name2
name3.........

but when running from the WEB :

the result is :

name1name2name3

Question :

how can i treat $fic_tmp5 to have the same display on the WEB ?

i hope that this time the "^M" is missing !!!!! maybe SED but i'm still searching !!!!

Christian