Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-13-2011, 01:24 PM   #1
Registered: Sep 2006
Posts: 62

Rep: Reputation: 15
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.
Old 07-13-2011, 02:28 PM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

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


Old 07-13-2011, 02:58 PM   #3
Registered: Sep 2006
Posts: 62

Original Poster
Rep: Reputation: 15
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:

Old 07-13-2011, 06:38 PM   #4
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.

Last edited by theNbomr; 07-13-2011 at 06:42 PM.


cgi, cgibin, method, shell script

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
C & kernel data structure & shell script vishalbutte Programming 7 01-13-2006 08:38 AM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
Script to get form bash? jrfly Linux - General 1 06-29-2005 10:04 AM
shell script works form command line but not form crontab saifee General 1 10-14-2004 10:27 AM
shell script form submit precioso77 Linux - General 2 05-18-2003 11:50 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:56 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration