Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to CGI, Need a form to have less feilds 1

Status
Not open for further replies.

Cadwalader

IS-IT--Management
Feb 12, 2002
297
US
Hello,

I am completely oblivious to any CGI scrpiting. Well, I can get "Hello, World!" to print to the screen, but that's it. my delemma involves 2 perl scripts: one does the work of putting form data into a database, that users can access and add to later...the other one generates the form that is to be filled out (and I guess the form with the data that has already been entered).

What I need to do is remove some of the fields. I tried just deleting the lines that I don't need, but that crippled the entire thing, nothing worked then (good thing I kept an unmodified copy of it!).

From what I understand, there is a little more involved in it to remove some of those fields...help? [bugeyed] Hope I was of some help...
--OR--
Thanks for the help...
--Rich

 
Give us a look at the code, if it is not a million lines long. 'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
well..
the file with the fields is like 30 lines long...but the one that "makes" is werk? is over 5300 lines... Hope I was of some help...
--OR--
Thanks for the help...
--Rich

 
Your description of your situation is to vague. I don't know where to grab a handle. There are quite a few possible trip points.

A few questions....

What OS are your running?
What web server are you running?
What Database are you running (oracle, sqlserver, access, flat files, spreadsheet, or what)?
How is your Perl connecting to the database?
What error statements are you getting?
What does your web server error log say about the error?
'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
OS RedHat 7.2
Database not sure which one is being used...

usr/bin/perl

error statements when i did remove lines...well, there were none, I would just get a 404.

But I have a bigger problem now. The whole thing quit working on Oct. 8. Sales plummeted, and since there is a discount for people that sign up (it's for a "clinical study"), that drags in a lot of sales. Anyway, the boss noticed that it's not working any more when you try to sign up. I don't know about logging in yet (so people can update their info and fill in stuff, like every 30 days or so).

I'll post the script for the fields, and thanks for the help.


Oh yeah, this isn't the WHOLE thing, just basic stuff that you whould have on any form (like a paper form), but I'd rather not post the whole thing because the questions on the form get...well, rather "graphic" and I don't want to gross anyone out.

18JG212U2H3B.
First Name::text:20
Last Name::text:20
Street Address::text:30
City::text:30
State::text:30
ZIP Code::text:20
Phone # With Area Code::text:12
E-mail Address::text:30
Age::text:3
Race::list:Caucasian,African American,Native American/Eskimo,Asian/Pacific Islander,Hispanic/Latino,Other
Weight::text:3
Height::text:10

it goes on, just like this. I know it doesn't have the usr/bin/perl at the top, but this file is just like an external .js file (I guess...). The file that is 5300 lines long is the one that has the #/usr/bin/perl up there...I guess that is the one that "runs". I am so soory to be such a lamer with perl, but I am really stuck. Thank you all very much for the help. Hope I was of some help...
--OR--
Thanks for the help...
--Rich

 
That chunk of text does not appear to be a 'script'. It appears to be a pattern or template for a data entry form.
Each line describes the characteristics of a data entry cell.
The main piece of code probably reads that template file
each time it runs to determine what the data entry screen
should look like.

The first thing that occurs to me has to do with file
permissions. On a Linux system, any program that runs has
an owner. When you run a program, the system knows to let that program do only those things that you have permmissions to do. You can't use the 'rm' command (program) to delete a file that I own. Similarly, when the web server runs a program (like a piece of CGI code) the system will only let that piece of CGI do what the web server has permissions to do. That is important when you edit a file that the web server wants to read or execute. If you edit it and then save it, you may have inadvertantly changed the read, write, and execute permissions on that file. And possibly changed them so that the web server can no longer use the file as it needs to.

Also, if you edit and save the CGI code, you may have inadvertantly changed the permissions. It must be executable by the web server.

After that, I'd start looking at the flow of data. If there are mandatory fields in the database and you remove one of those items from the template file, then the database will be quite unhappy. So, if you want remove a line from that template file, you must make sure that there are no depedencies on that field first.

Do you have any documentation for the system?

404 is a 'File Not Found' error. Are you sure the CGI code is where it should be and is executable by the web daemon? 'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
goBoating,

Wow, thanks for the info. I am reletively new to Linux, nut I know about file permissions. I have only been using Linux for about a month now, and recently had a file permissions nightmare on my server (I have one at home built out of spare parts (except the HDD, I had to buy a new one)for educational purposes).

I found that the cgi is referencing an SQL database. I had to dig around in that thing to find out where it was looking to sendmail so I could change it. I don't know anything about the old server, except that it had sendmail in /usr/bin/sendmail, and the new server has it in /usr/sbin/sendmail. I preferred to change the script, rather than move sendmail (can you see the inevitability of the nightmare that would create?). I am quite proud of myself, because it's working now. It sends an email to the boss, just like it's supposed to when a new user signs up, and current users can log in, and change/update/add info, and the changes are sticking.

So all is well now except the fields...database aside, can fields just be deleted? (Oh, BTW, I figured the form field thing was a referenced file, like it doesn't actually "run", but is more like in include in JS, but it's parsed by the server)Of course, after modifying the file,I will check file permissions and change accordingly. The strange thing was that yesterday, I had to set httpd to run cgi's and then set all the file permissions for the cgi (it's like 5 different files). Come to think of it, the data is written to a file with a . on the server, in the very same cgi-bin. When viewed, it's just one long line of data (names, addresses, etc), with those silly little carriage returns that are not compatable with Windows.

Ok, I'll stop rambling. If the fields can just be deleted, that's great. I'll migrate everything except the user data to my server at home (running this cgi on my server is going to burn the dust off the CPU heatsink) and test it there (live server at work is RedHat 7.2, home is RedHat 7.3, and both are running the same version of Apache).

Thank you very, very much for your help :) Hope I was of some help...
--OR--
Thanks for the help...
--Rich
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top