Basic FILEHANDLE Question 
Author Message
 Basic FILEHANDLE Question

I've been working on a cgi script that takes the string of values
returned from an html form and puts them into a text file with
tab delimiters. After about six hours of attempting to debug it,
the NCSA http server still returns the following error (I've gotten
many errors, but this is the most recent):

[Sat Jan 28 21:33:42 1995] httpd: malformed header from script
1 at /usr/local/etc/httpd/cgi-bin/ps_reply line 42.

I did a very simplified version of this routine and it created the
file ps_dbfile and put the string into it without any problem,
but this version just doesn't want to work. It won't create the file,
nor will it append an existing one. The rest of the script
runs fine if I comment this section out. I'm beat and at the end
of my rope, so any help will be greatly appreciated. Here's the
excerpted problem area...

-------------------------------------------------------

$ps_dbfile = "/usr/local/etc/httpd/cgi-bin/ps_dbfile";

        # Write the form information to a tab-delimited database file.

                $dbstring = sprintf("%s/t%s/t%s/t%s/t%s/t%s/t%s/t%s/t%s/t%s/t%s/t/n",
                                                                $FORM{name},$FORM{title}, $FORM{company}, $FORM{address},
                                                                $FORM{city}, $FORM{state}, $FORM{zip}, $FORM{user_email},
                                                                $FORM{phone}, $FORM{comments}, $FORM{story});

                open(DBFILE, ">>$ps_dbfile") ||  die &error_message;
                print DBFILE $dbstring;
                close(DBFILE);

-----------------------------------------------------

Thanks,
Jeff Aldrich
Univerisity of Minnesota



Thu, 17 Jul 1997 12:34:28 GMT  
 Basic FILEHANDLE Question
Sorry if you're seeing this twice, it didn't appear to come across the
first time.

I've been working on a script to put form data returned from and html
form
into a standard text file as tab-delimited text so it can be put into a
database at a
later time. For the most part, the script works fine, but it isn't
creating/appending the data to the ps_dbfile like I want it to. I've
created a
simplified version of the routine that runs fine, but each time I run the
whole
thing, the NCSA http server returns an error and I get nothing in my
ps_dbfile. Here is the part of the script that's causing the problem. Any
help
would be greatly appreciated. The $dbtring variable seems fine, I think
the
problems's with the <<open(DBFILE...)>>. Here it is...

------------------------------------------------------------
$ps_dbfile = "/usr/local/etc/httpd/cgi-bin/ps_dbfile";

# Write the form information to a tab-delimited database file.

$dbstring=sprintf("%s/t%s/t%s/t%s/t%s/t%s/t%s/t%s/t%s/t%s/t%s/t/n",
        $FORM{name},$FORM{title}, $FORM{company}, $FORM{address},
        $FORM{city}, $FORM{state}, $FORM{zip}, $FORM{user_email},
        $FORM{phone}, $FORM{comments}, $FORM{story});

open(DBFILE, ">>$ps_dbfile") ||  die &error_message;
print DBFILE $dbstring;
close(DBFILE);
-----------------------------------------------------------

Thanks in advance,
Jeff Aldrich
University of Minnesota



Thu, 17 Jul 1997 14:12:17 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. CGI Question Basic Question - Kindof

2. Basic, Basic stuff

3. Question on with LWP (very basic)

4. basic "open" question

5. Very basic perl question

6. a small really basic question about printing to a file

7. basic question

8. Very basic chop question

9. basic question

10. Basic Question

11. Splitting text that goes beyond column 80 (A basic question)

12. 2 basic questions

 

 
Powered by phpBB® Forum Software