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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem With My Script?

Status
Not open for further replies.

kickinpretty

Technical User
Jul 26, 2002
17
GB
Hi

I have tested the following script out which works fine...

#!/usr/bin/perl

require "subparseform.lib";
&Parse_Form;

#Credits
#Author: Jeffrey F. Hill
#Website: #Usage: Use this script for anything - It's doubtful that anyone will give me any credit
#so I'm not askin for any. If you have any projects requiring dynamic flash in the future
#Please Keep me in Mind.

$Title = $formdata{'Title'};
$Contact = $formdata{'Contact'};
$About = $formdata{'About'};
$News = $formdata{'News'};
$Products = $formdata{'Products'};
$Link = $formdata{'Link'};

@New = ("Title=$Title&Contact=$Contact&About=$About&Products=$Products&News=$News&Link=$Link");

open (LOG, ">/var/ || &ErrorMessage;
print LOG "@New";
close (LOG);


print "Content-type: text/html\n\n";
print "Status=Success - Your Comments have beed updated. Please return to the main area to see the results";

sub ErrorMessage {
print "Content-type: text/html\n\n";
print "Status=Connection Failed Please Check the path to the text File";
exit;
}



I have modified this script for my own use like so...

#!/usr/bin/perl

require "subparseform.lib";
&Parse_Form;

#Credits
#Author: Jeffrey F. Hill
#Website: #Usage: Use this script for anything - It's doubtful that anyone will give me any credit
#so I'm not askin for any. If you have any projects requiring dynamic flash in the future
#Please Keep me in Mind.

$'1a' = $formdata{'1a'};
$1b = $formdata{'1b'};
$1c = $formdata{'1c'};
$1d = $formdata{'1d'};
$1e = $formdata{'1e'};
$2a = $formdata{'2a'};
$2b = $formdata{'2b'};
$2c = $formdata{'2c'};
$2d = $formdata{'2d'};
$2e = $formdata{'2e'};
$3a = $formdata{'3a'};
$3b = $formdata{'3b'};
$3c = $formdata{'3c'};
$3d = $formdata{'3d'};
$3e = $formdata{'3e'};
$4a = $formdata{'4a'};
$4b = $formdata{'4b'};
$4c = $formdata{'4c'};
$4d = $formdata{'4d'};
$4e = $formdata{'4e'};
$5a = $formdata{'5a'};
$5b = $formdata{'5b'};
$5c = $formdata{'5c'};
$5d = $formdata{'5d'};
$5e = $formdata{'5e'};
$6a = $formdata{'6a'};
$6b = $formdata{'6b'};
$6c = $formdata{'6c'};
$6d = $formdata{'6d'};
$6e = $formdata{'6e'};
$7a = $formdata{'7a'};
$7b = $formdata{'7b'};
$7c = $formdata{'7c'};
$7d = $formdata{'7d'};
$7e = $formdata{'7e'};
$8a = $formdata{'8a'};
$8b = $formdata{'8b'};
$8c = $formdata{'8c'};
$8d = $formdata{'8d'};
$8e = $formdata{'8e'};
$9a = $formdata{'9a'};
$9b = $formdata{'9b'};
$9c = $formdata{'9c'};
$9d = $formdata{'9d'};
$9e = $formdata{'9e'};
$10e = $formdata{'10e'};
$11a = $formdata{'11a'};
$11b = $formdata{'11b'};
$11c = $formdata{'11c'};
$11d = $formdata{'11d'};
$11e = $formdata{'11e'};
$12a = $formdata{'12a'};
$12b = $formdata{'12b'};
$12c = $formdata{'12c'};
$12d = $formdata{'12d'};
$12e = $formdata{'12e'};
$13a = $formdata{'13a'};
$13b = $formdata{'13b'};
$13c = $formdata{'13c'};
$13d = $formdata{'13d'};
$13e = $formdata{'13e'};
$14a = $formdata{'14a'};
$14b = $formdata{'14b'};
$14c = $formdata{'14c'};
$14d = $formdata{'14d'};
$14e = $formdata{'14e'};
$15a = $formdata{'15a'};
$15b = $formdata{'15b'};
$15c = $formdata{'15c'};
$15d = $formdata{'15d'};
$15e = $formdata{'15e'};
$16a = $formdata{'16a'};
$16b = $formdata{'16b'};
$16c = $formdata{'16c'};
$16d = $formdata{'16d'};
$16e = $formdata{'16e'};
$17a = $formdata{'17a'};
$17b = $formdata{'17b'};
$17c = $formdata{'17c'};
$17d = $formdata{'17d'};
$17e = $formdata{'17e'};
$18a = $formdata{'18a'};
$18b = $formdata{'18b'};
$18c = $formdata{'18c'};
$18d = $formdata{'18d'};
$18e = $formdata{'18e'};
$19a = $formdata{'19a'};
$19b = $formdata{'19b'};
$19c = $formdata{'19c'};
$19d = $formdata{'19d'};
$19e = $formdata{'19e'};
$20a = $formdata{'20a'};
$21a = $formdata{'21a'};
$21b = $formdata{'21b'};
$21c = $formdata{'21c'};
$21d = $formdata{'21d'};
$21e = $formdata{'21e'};
$22a = $formdata{'22a'};
$22b = $formdata{'22b'};
$22c = $formdata{'22c'};
$22d = $formdata{'22d'};
$22e = $formdata{'22e'};
$23a = $formdata{'23a'};
$23b = $formdata{'23b'};
$23c = $formdata{'23c'};
$23d = $formdata{'23d'};
$23e = $formdata{'23e'};
$24a = $formdata{'24a'};
$24b = $formdata{'24b'};
$24c = $formdata{'24c'};
$24d = $formdata{'24d'};
$24e = $formdata{'24e'};
$25a = $formdata{'25a'};
$25b = $formdata{'25b'};
$25c = $formdata{'25c'};
$25d = $formdata{'25d'};
$25e = $formdata{'25e'};
$26a = $formdata{'26a'};
$26b = $formdata{'26b'};
$26c = $formdata{'26c'};
$26d = $formdata{'26d'};
$26e = $formdata{'26e'};
$27a = $formdata{'27a'};
$27b = $formdata{'27b'};
$27c = $formdata{'27c'};
$27d = $formdata{'27d'};
$27e = $formdata{'27e'};
$28a = $formdata{'28a'};
$28b = $formdata{'28b'};
$28c = $formdata{'28c'};
$28d = $formdata{'28d'};
$28e = $formdata{'28e'};
$29a = $formdata{'29a'};
$29b = $formdata{'29b'};
$29c = $formdata{'29c'};
$29d = $formdata{'29d'};
$29e = $formdata{'29e'};
$30a = $formdata{'30a'};
$31a = $formdata{'31a'};
$31b = $formdata{'31b'};
$31c = $formdata{'31c'};
$31d = $formdata{'31d'};
$31e = $formdata{'31e'};
$32a = $formdata{'32a'};
$32b = $formdata{'32b'};
$32c = $formdata{'32c'};
$32d = $formdata{'32d'};
$32e = $formdata{'32e'};
$33a = $formdata{'33a'};
$33b = $formdata{'33b'};
$33c = $formdata{'33c'};
$33d = $formdata{'33d'};
$33e = $formdata{'33e'};
$34a = $formdata{'34a'};
$34b = $formdata{'34b'};
$34c = $formdata{'34c'};
$34d = $formdata{'34d'};
$34e = $formdata{'34e'};
$35a = $formdata{'35a'};
$35b = $formdata{'35b'};
$35c = $formdata{'35c'};
$35d = $formdata{'35d'};
$35e = $formdata{'35e'};
$36a = $formdata{'36a'};
$36b = $formdata{'36b'};
$36c = $formdata{'36c'};
$36d = $formdata{'36d'};
$36e = $formdata{'36e'};
$37a = $formdata{'37a'};
$37b = $formdata{'37b'};
$37c = $formdata{'37c'};
$37d = $formdata{'37d'};
$37e = $formdata{'37e'};
$38a = $formdata{'38a'};
$38b = $formdata{'38b'};
$38c = $formdata{'38c'};
$38d = $formdata{'38d'};
$38e = $formdata{'38e'};
$39a = $formdata{'39a'};
$39b = $formdata{'39b'};
$39c = $formdata{'39c'};
$39d = $formdata{'39d'};
$39e = $formdata{'39e'};
$40a = $formdata{'40a'};
$40b = $formdata{'40b'};
$40c = $formdata{'40c'};
$40d = $formdata{'40d'};
$40e = $formdata{'40e'};

@New = ("1a=$1a&1b=$1b&1c=$1c&1d=$1d&1e=$1e&2a=$2a&2b=$2b&2c=$2c&2d=$2d&2e=$2e&3a=$3a&3b=$3b&3c=$3c&3d=$3d&3e=$3e&4a=$4a&4b=$4b&4c=$4c&4d=$4d&4e=$4e&5a=$5a&5b=$5b&5c=$5c&5d=$5d&5e=$5e&6a=$6a&6b=$6b&6c=$6c&6d=$6d&6e=$6e&7a=$7a&7b=$7b&7c=$7c&7d=$7d&7e=$7e&8a=$8a&8b=$8b&8c=$8c&8d=$8d&8e=$8e&9a=$9a&9b=$9b&9c=$9c&9d=$9d&9e=$9e&10a=$10a&10b=$10b&10c=$10c&10d=$10d&10e=$10e&11a=$11a&11b=$11b&11c=$11c&11d=$11d&11e=$11e&12a=$12a&12b=$12b&12c=$12c&12d=$12d&12e=$12e&13a=$13a&13b=$13b&13c=$13c&13d=$13d&13e=$13e&14a=$14a&14b=$14b&14c=$14c&14d=$14d&14e=$14e&15a=$15a&15b=$15b&15c=$15c&15d=$15d&15e=$15e&16a=$16a&16b=$16b&16c=$16c&16d=$16d&16e=$16e&17a=$17a&17b=$17b&17c=$17c&17d=$17d&17e=$17e&18a=$18a&18b=$18b&18c=$18c&18d=$18d&18e=$18e&19a=$19a&19b=$19b&19c=$19c&19d=$19d&19e=$19e&20a=$20a&20b=$20b&20c=$20c&20d=$20d&20e=$20e&21a=$21a&21b=$21b&21c=$21c&21d=$21d&21e=$21e&22a=$22a&22b=$22b&22c=$22c&22d=$22d&22e=$22e&23a=$23a&23b=$23b&23c=$23c&23d=$23d&23e=$23e&24a=$24a&24b=$24b&24c=$24c&24d=$24d&24e=$24e&25a=$25a&25b=$25b&25c=$25c&25d=$25d&25e=$25e&26a=$26a&26b=$26b&26c=$26c&26d=$26d&26e=$26e&27a=$27a&27b=$27b&27c=$27c&27d=$27d&27e=$27e&28a=$28a&28b=$28b&28c=$28c&28d=$28d&28e=$28e&29a=$29a&29b=$29b&29c=$29c&29d=$29d&29e=$29e&30a=$30a&30b=$30b&30c=$30c&30d=$30d&30e=$30e&31a=$31a&31b=$31b&31c=$31c&31d=$31d&31e=$31e&32a=$32a&32b=$32b&32c=$32c&32d=$32d&32e=$32e&33a=$33a&33b=$33b&33c=$33c&33d=$33d&33e=$33e&34a=$34a&34b=$34b&34c=$34c&34d=$34d&34e=$34e&35a=$35a&35b=$35b&35c=$35c&35d=$35d&35e=$35e&36a=$36a&36b=$36b&36c=$36c&36d=$36d&36e=$36e&37a=$37a&37b=$37b&37c=$37c&37d=$37d&37e=$37e&38a=$38a&38b=$38b&38c=$38c&38d=$38d&38e=$38e&39a=$39a&39b=$39b&39c=$39c&39d=$39d&39e=$39e&40a=$40a&40b=$40b&40c=$40c&40d=$40d&40e=$40e");

open (LOG, ">/var/ || &ErrorMessage;
print LOG "@New";
close (LOG);


print "Content-type: text/html\n\n";
print "status=Success - Your Comments have beed updated. Please return to the main area to see the results";

sub ErrorMessage {
print "Content-type: text/html\n\n";
print "status=Connection Failed Please Check the path to the text File";
exit;
}


*******i now get the following error reported in my server log...*********


(Missing operator before a?)
syntax error at /var/ line 13, near "$1a "
Execution of /var/ aborted due to compilation
errors.
[Wed Jul 31 13:53:41 2002] [error] [client 192.168.0.253] Premature end of
script headers: /var/


Does this mean that i cant use numbered variable names such as "1a" within perl or should i be inserting some additional syntax????

Any suggestions would be very welcome :)
 
Looks like a typo at the top. You have:

$'1a' = $formdata{'1a'};
$1b = $formdata{'1b'};
$1c = $formdata{'1c'};

Should this be:

$1a = $formdata{'1a'};
$1b = $formdata{'1b'};
$1c = $formdata{'1c'};


Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
please ignore the $'1a' on line 13 of the modified script it is $1a in the script on the server......i pasted in the wrong file.... my first post still applies so any advice would be helpful

Thanks
 
Varibale names that begin with a digit must be all digits.

In general, it's not a good idea to use variable names starting with digits even if you can. AFAIK, Perl is the only language that even allows it.
 
thanks for the reply....i sort of sussed that out having tested a few trial file names ...oh well just means i have to rename all of my variables and redo the scripts...you can only learn by your mistakes as the saying goes:)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top