http://www.perlmonks.org?node_id=1034570


in reply to Executing perl script with html textarea

I think most of the answer to this question is HTML not Perl, but I'll answer it anyway.

The easy way of selecting a question would be an HTML select list.

<form method="post" action="http://myserver/perl_script"> <p>Which question do you want to answer? <select name="question"> <option value="1">Question 1</option> <option value="2">Question 2</option> <option value="3">Question 3</option> <option value="4">Question 4</option> </select> </p> <p>Answer your question in the textbox:<br /> <textarea name="answer" rows="20" cols="70"></textarea> <input type="submit" value="submit"/> </form>
The Perl script to read the answers would be something like
#!/usr/bin/perl use strict; use warnings; use CGI; my $cgi = CGI->new; my $question= $cgi->param("question"); my $answer = $cgi->param("answer");
If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)