
fashimpaur
User
/ Moderator
Aug 2, 2001, 4:36 AM
Post #2 of 14
(987 views)
|
Etheracide, What a mangled up, tangled up, knot! First of all, a CGI post does not put data into the $ENV{QUERY_STRING}. It puts the data to <STDIN>. You would never see the data in your string. Read on and I will show you how to do this correctly. Okay, trying to make sense of things let's start by asking some of the simple questions. Do you have a basic understanding of perl modules? I ask this not to be rude but just for my information's sake. If you do, then, as the end of your script said: use CGI; Here's what I mean: #!/usr/local/bin/perl # mycgi.cgi use strict; use CGI; use CGI::Carp 'fatalsToBrowser'; my $query = new CGI; $itemnumber = $query->param('ID'); # now you can use itemnumber anywhere you need it. Next, don't use .txt files for your data storage. The simple reason for this is that the data can get corrupted if more than one user tries to submit the form at a time, thus potentially overwriting the changes of the second user. Also, as the text file size increases, the access time into that file also increases and the overall performance of your program will suffer. You are better off to truly create a database in Oracle, Sybase, MS SQL, or Access even. These can be set up to have row level locking so multiple people can access the data and modify their own entries without corrupting the whole data integrity. Lastly, you should be using Perl 5.0 or higher now. That being the case, you no longer need to explicity use the ampersand (&) to indicate a subroutine is being called. Simply request the subroutine to be executed. Like this: #!/usr/local/bin/perl # mycgi.cgi # assuming you have a hidden variable in the form # named 'Type' with a value of 'vote' or 'view', and your # form tag should simply be: # <form method='post' action='mycgi.cgi'> use CGI; use CGI::Carp 'fatalsToBrowser'; use strict; my $query = new CGI; my $formtype = $query->param('Type'); if ($formtype eq "vote") { voteform; } else { view; } HTH, Dennis $a="c323745335d3221214b364d545a362532582521254c3640504c37292f493759214b3635554c3040606a0",print unpack"u*",pack "h*",$a,"\n\n"
|