in reply to Re: Trying to write a CGI script for this piece of HTML
in thread Trying to write a CGI script for this piece of HTML
I was able to implement yesterday your recommandation on the part section script: open(OUT, "> dataform.html") or die "Can't open file: $!"; print "Candidate: $candidate\n"; print "Position: $position\n"; print "Education: $Education\n\n"; close OUT; It creates the file but when I view it there are no contents. What do's the OUT command do? I'm learning a bit more and I tried other command lines like
open(FH, ">> $path"); sysopen(FH, $path, O_APPEND); # but this one gives me an error:(
I'm trying to write code to capture the values from a URL address line + and have them sent to a file to be entered and appended for me to view later. The below code is what I'm trying to debug,because I can't get these v +alues "John,Technician & BSdegree" from the following URL string "candidate=John&position=Technician&educ +ation=BSdegree" to get added to the dataform.html file. This script creates the file "dataform.html file" but no values are co +ntained... Any ideas or more perl wisdom:)
#!/usr/bin/perl -w use strict; sub url_decode { # capture the values from the URL command line my $text = shift(); $text =~ tr/\+/ /; # substitute the + for spaces $text =~ s/%([a-f0-9][a-f0-9])/chr( hex( $1 ) )/eg; # clean up URL + string use CGI; # set my paramenters my $q = new CGI; my $candidate = $q->param('candidate'); my $position = $q->param('position'); my $education = $q->param('education'); # send the values from my URL command line to the dataform.html to be +added and appended: open(OUT, "> dataform.html") or die "Can't open file: $!"; print "Candidate: $candidate\n"; print "Position: $position\n"; print "Education: $Education\n\n"; close OUT;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Trying to write a CGI script for this piece of HTML
by IlyaM (Parson) on Nov 28, 2001 at 22:31 UTC |