Thanks, I will try your suggestion and let you know the results. ----- Original Message ----- From: "Jason Jolly" <[EMAIL PROTECTED]> To: "Horace Franklin Jr." <[EMAIL PROTECTED]> Sent: Tuesday, March 25, 2003 4:31 PM Subject: Re: Help using %Hashes
> Yeah. > > You'll probably want to do something like Bob Showalter suggested: > > #!/usr/bin/perl > > use CGI; > > my $cgi = new CGI; > my $name_from_input = $cgi->params("name"); > my $email_from_input = $cgi->params("email"); > my $message_from_input = $cgi->params("message"); > > if (length($ENV{QUERY_STRING}) == 0){ > open (AFILE, "/tmp/filename.txt"); > ## place code here to write to file...you may access the > ## $name_from_input, $email_from_input, $message_from_input > variables ..... > close (AFILE); > } else { > print ("<h3>Hello!</h3>"); > print ("<form action=" . $ENV{HTTP_HOST} . $ENV{SCRIPT_NAME} . " > method='post'>"); > print ("<p><b>My name is</b>: <input type='text' > name='name'/></p>"); > print ("<p><b>My E-mail is</b>: <input type='text' > name='email'/></p>"); > print ("<p><b>Message</b>:</p>"); > print ("<p><textarea cols='30' rows='6' wrap='virtual' > name='message'></p>"); > print ("<p>Type your message here."); > print ("</textarea>"); > print ("<input type='submit'></p>"); > print ("</form>"); > } > > that will first display the form and then, when the submit button is > pressed, the form will submit to itself and you may extract the appropriate > data using the CGI.pm module. > > If you are uncomfortable using (or don't have it installed) you may try to > parse the name/value pairs in the $ENV{QUERY_STRING} variable using the > split() command. > > thnx, > > ~j > > ----- Original Message ----- > From: "Horace Franklin Jr." <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]>; "Jason Jolly" <[EMAIL PROTECTED]> > Sent: Tuesday, March 25, 2003 4:00 PM > Subject: Re: Help using %Hashes > > > > Jason, > > > > There is no prerequisite that causes me to use hashes. > > > > I am a novice trying to write a cgi script that can > > be called by an html file, Once the script is called > > it will open file(s), displays the form, receive > > input from user, write the input to a file, close file(s), > > and provide the user with a response. > > > > I thought using hashes are one way to accomplish > > the above tasks. > > > > Is there a better way to accomplish the above task? > > > > Horace > > ----- Original Message ----- > > From: "Jason Jolly" <[EMAIL PROTECTED]> > > To: "Horace Franklin Jr." <[EMAIL PROTECTED]> > > Sent: Tuesday, March 25, 2003 3:19 PM > > Subject: Re: Help using %Hashes > > > > > > > Horace, > > > > > > Are you unsure how to reference the information which will be posted to > > the > > > URI kept by the '$url' value? > > > > > > I'll gladly help you through getting the post values into your > > > program....I'm not sure the use of a hash will be necessary though. Is > > > there a prerequisite which is causing you to use a hash? > > > > > > thnx, > > > > > > ~j > > > ----- Original Message ----- > > > From: "Horace Franklin Jr." <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Tuesday, March 25, 2003 3:18 PM > > > Subject: Help using %Hashes > > > > > > > > > > Help! > > > > > > > > I need help using %hashes to receive input from the form below. > > > > > > > > What changes would I make to the syntax of the commented lines > > > > below to do this?. > > > > > > > > > > > > my $form = <<E_FORM; > > > > <h3>Hello!</h3> > > > > <form action="$url" method="post"> > > > > # <p><b>My name is</b>: <input type="text" name="name"/></p> > > > > # <p><b>My E-mail is</b>: <input type="text" name="email"/></p> > > > > <p><b>Message</b>:</p> > > > > # <p><textarea cols="30" rows="6" wrap="virtual" > > > > name="message"></p> > > > > <p>Type your message here. > > > > </textarea> > > > > <input type="submit"></p> > > > > </form> > > > > E_FORM > > > > > > > > $form; > > > > > > > > > > > > -- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]