How to pass arguments from a textbox in CGI to a shell script?

Hello All,

Could you please help me to explain that how do I pass textboxes values while running a shell script which need some arguments while running it and should be invoked after the button click.

Here is an example.

The first CGI is:
#!/bin/ksh
echo "Content-Type: text/html"
echo
echo "<HTML>"
 echo "<HEAD>"
echo "<TITLE>Refresh status</TITLE>"
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">"
echo "<SCRIPT TYPE=\"text/javascript\">"
 echo "<!--"
 echo "window.focus();"
 echo "//-->"
 echo "</SCRIPT>"
 echo "</HEAD>"
 echo "<BODY  TEXT vlink="black" link="blue" alink="white" >"
 echo "<CENTER><STRONG>test status form</STRONG></CENTER>"
echo "<FORM METHOD=POST ACTION=output.cgi>"
echo "Number of days: <input type="text" name="days"><br>"
echo "Stage: <input type="text" name="stage"><br>"
echo "Project Name: <input type="text" name="project"><br><br>"
echo "<input type="submit" value="Press button Submit generate output">"
echo "</FORM>"
 echo "</BODY>"
 echo "</HTML>"

 
 
The second CGI is where script is being called:
#!/bin/bash
echo "Content-Type: text/html"
echo
echo "<HTML>"
 echo "<HEAD>"
echo "<TITLE>Refresh status OUTPUT</TITLE>"
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">"
echo "<SCRIPT TYPE=\"text/javascript\">"
 echo "<!--"
echo "window.focus();"
 echo "//-->"
 echo "</SCRIPT>"
ksh test2.ksh stage project days (Here only problem is occuring while passing the arguments which are being generated by user with help of 1st cgi)
 echo "</HEAD>"
 echo "<BODY>"
echo "Done"
echo "<FORM METHOD=POST ACTION=htm_check_final.html>"
echo "<input type="submit" value="result">"
echo "</FORM>"
 echo "</BODY>"
 echo "</HTML>"

Could you please help.

Thanks,
R. Singh

Hello All,

Really sorry to bother you all, could you please guide on same.
I really tried hard to search it but couldn't find a solution for same.

Will be grateful to you.

Thanks,
R. Singh

Bumping up the post wont help you to give fast replies and that's against the forum rules.
If you do need it urgently, post it under "Emergency UNIX and Linux Support"

What you have tried? Could you please show?

Whats the output of the first script and in what way you want to use the arguments in the seconds script.

Hello clx,

Sorry I was not having intention to bump up the posts. I have first cgi in which I have prepared a form and asking users for three values which user wil enter in a text box. Then I have second cgi in which I am calling UNIX script, now I want to pass these arguments to that unix script as follows.

/bin/ksh
echo "Content-Type: text/html"
echo
echo "<HTML>"
 echo "<HEAD>"
echo "<TITLE>test status</TITLE>"
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">"
echo "<SCRIPT TYPE=\"text/javascript\">"
 echo "<!--"
 echo "window.focus();"
 echo "//-->"
 echo "</SCRIPT>"
 echo "</HEAD>"
 echo "<BODY  TEXT vlink="black" link="blue" alink="white" >"
 echo "<CENTER><STRONG>Test status form</STRONG></CENTER>"
echo "Number of days: <input type="text" name="days"><br>"
echo "Stage: <input type="text" name="stage"><br>"
echo "Project Name: <input type="text" name="project"><br><br>"
echo "<input type="submit" value="Press button Submit generate output">"
echo "<FORM METHOD=POST ACTION=output.cgi>"
echo "</FORM>"
 echo "</BODY>"
 echo "</HTML>"

2nd cgi:

#!/bin/bash
echo "Content-Type: text/html"
echo
echo "<HTML>"
 echo "<HEAD>"
echo "<TITLE>Refresh status OUTPUT</TITLE>"
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">"
echo "<SCRIPT TYPE=\"text/javascript\">"
 echo "<!--"
echo "window.focus();"
 echo "//-->"
 echo "</SCRIPT>"
 echo "</HEAD>"
 echo "<BODY>"
ksh test2.ksh stage project days
echo "<FORM METHOD=POST ACTION=htm_check_final.html>"
echo "<input type="submit" value="result">"
echo "</FORM>"
 echo "</BODY>"
 echo "</HTML>"

kindly let me know if you have any queries.

Thanks,
R. Singh

If I got you right,

ksh test2.ksh stage project days

Inside test2.ksh , You need to do something like

STAGE=$1
PROJECT=$2
DAYS=$3

Now, $STAGE, $PROJECT and $DAYS would contain the value stage, project and days respectively inside the script.