Again I just don't understand how the parameter is assinged its value? Can anyone help me with this?#!/usr/bin/perl use CGI; $query = new CGI; $topic_directory = "topics"; if($query->param('topic')){ $topic = $query->param('topic'); &file_error unless (&open_topic); &format_error unless (&parse_topic); &print_page_start; &print_topic; &print_response_form; print "<P>Return to the <A HREF=\"display.pl\">Topic list</A>.</P>\n"; &print_page_end; } else{ &page_title = "Topic Index"; &print_page_start; &print_topic_index; &print_page_end; } sub print_page_start{ print $query->header; sub print_topic_index{ eval{ opendir(TOPICS, "$topic_directory") or die "Can't open $topic_directory"; @topics = grep (/^.+\.txt$/, readdir (TOPICS)); foreach $topic (@topics){ $topic =~ s/(.+)\.txt/$1/; &open_topic; &parse_topic; print "<A HREF=\"display.pl?topic=$topic\">"; print "$page_title</A>, $topic_author<BR>\n"; } }; } ........ .......#<CODE HERE WAS OMITTED> The following code contains the form that holds the variable contents +for $topic The problem that I am having is I do not understand how the t +opic parameter in the form is passed a topic ID when it is a hidden field? + The code for the form creation is below: sub print_response_form{ print "<FORM METHOD=\"post\" ACTION=\"post.pl\">\n"; print "<INPUT TYPE=\"hidden\" NAME=\"action\" "; print "VALUE=\"response\">\n"; print "<INPUT TYPE=\"hidden\" NAME=\"response_to\" "; print "VALUE=\"$topic\">\n"; print "Author: "; print "<INPUT TYPE=\"text\" NAME=\"author\" "; print "SIZE=40 MAXLENGHT=72 VALUE=\"$author\"><BR>\n"; print "Message body: <BR>\n"; print "<TEXTAREA ROWS=10 COLS=60 NAME=\"post\"; print "WRAP=\"virtual\">"; print "......... .................................. .
In reply to Help understanding this script by WarrenBullockIII
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |