in reply to Entering data into MySql using CGI
Can I have only one textarea (2columns 52rows) to accept all the states that she wishes to input and then parse that data?
OK, I wanted to just say "yes," because this really smells of homework (the restriction on the UI, for instance). But given that you *did* pose a specific question ...
CGI.pm isn't really the controlling factor. It depends on how the *user* enters it -- do they put line breaks or other spacers in themselves, or do they type it all in without spacers of any sort? So my advice is, in the HTML that presents the form with the text input field (be it an input field or a textarea), you tell the users what you want, and have your program proceed according to that. Visually easiest on you and on your users, I would think, is a comma or a space. Then, you just use split on the resulting string that you get using CGI.pm's param function. split is wicked-easy to use:
my $string="these are the times that try men's souls"; my @words = split /\s/, $string; # @words now holds "these", "are", "the" ... etc.
HTH
perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Entering data into MySql using CGI
by ghost (Beadle) on Oct 09, 2001 at 01:37 UTC | |
by cLive ;-) (Prior) on Oct 09, 2001 at 04:59 UTC | |
by ghost (Beadle) on Oct 09, 2001 at 07:18 UTC |