-   Programming (
-   -   form data as $1, shell script & cgi (

haiders 07-13-2011 01:24 PM

form data as $1, shell script & cgi
I have a form page custlookup.html:


<title> Forms </title>
<FORM METHOD="POST" action="">
Choose your option
Enter device name  <INPUT TYPE="TEXT" NAME="devid" SIZE=20 MAXLENGTH=25>
<INPUT TYPE="Submit" NAME="Submit This Form">
<INPUT TYPE="Reset" NAME="Clear">

I would like to be able to take the input (devid) provided in the form on the webpage and execute the script with the devid appended as the case.
Should execute as follows on the server:

% ./ $devid

I tried appending the method with the $devid but that doesn't seem to work:

<FORM METHOD="POST" action=" $devid">
Unfortunately, I'm not a developer, web page designer, or scriptor so your explanation in laymans terms is appreciated.

Tinkster 07-13-2011 02:28 PM

Try modifying the script to use FORM_devid rather
than passing variables to the script. (Assuming you're
using proccgi).



haiders 07-13-2011 02:58 PM

Thanks for the reply Tinkster. I wasn't aware of proccgi until you mentioned it. I just googled it and it appears to be a variable translator from web form to shell scripts which appears to be exactly what i need. But as I mentioned my scripting skills are joke worthy so I have some basic questions for you:
1 - how do I determine if proccgi is installed on the server?
2 - how can I troubleshoot my issues since monitoring the error.log in apache doesn't seem to provide any errors. I'd like to see what variable if any the script is taking so that I may attempt to correct it.

With the current config i get the following one liner result on my web page:


theNbomr 07-13-2011 06:38 PM

I think simply using HTTP GET rather than POST will cause the web server to pass arguments via the CGI commandline, rather than STDIN. Your CGI will get arguments from all form elements, and they will be of the form "?key1=value1&key2=value2&...." You should be able to parse out the key/value pairs in your script, especially since your list of form elements appears to be small.

--- rod.

All times are GMT -5. The time now is 12:25 AM.