As always, your comments are deeply appreciated, Joseph. ----- Original Message ----- From: "R. Joseph Newton" <[EMAIL PROTECTED]> To: "Horace Franklin Jr." <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, March 25, 2003 10:13 PM Subject: Re: I need help using %Hashes
> "Horace Franklin Jr." wrote: > > > 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"> <!--Don't quote keywords like 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; > > Hi Horace, > > You really need to understand the difference between Perl and HTML. Those lines are not commented. In HTML, a comment begins <!-- and ends -->. Perl and HTML are completely different languages, used in completely different settings. Perl can be used to generate HTML, though. > > You do need to start with good texts on HTML, on CGI, and on Perl. At least one for each. > > In brief, though, when the user clicks the button--which will have no text, since you have not given the submit input a value parameter--the browser will send a POST request to the given URL. The url will ahve the form values encoded in it like: > > http://my_isp.com/~my_user/cgi-bin/my_script.cgi?name=Horace+Franklin+Jr%2A& email=my_email%40my_isp.com > > You Perl program will then read the part following ? from STDIN. > Your job, or that of the module you use will be to read it, split the query lin on & first, tpo separate the key/pairs, then split each pair on = to get the name and value for that pair. Generally the keys will be clean, since you or the web-page writer can control that. The values though, will. have to be unescaped, first by using the tr function to replace each '+' with ' ', then by pack()ing each hex sequence with the character equivalent of its hex value. > > For each pair, one it has been separated and cleaned into it's name and value portions, can be entered to the hash like. > > $cgi_return{$name} = $value; > > Having written that all out, I can understand why many would prefer to just use a module. > > Joseph > > > -- > 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]
