Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

How to redisplay previously submitted text

by lauragarcia (Acolyte)
on Apr 25, 2001 at 21:46 UTC ( [id://75552]=perlquestion: print w/replies, xml ) Need Help??

lauragarcia has asked for the wisdom of the Perl Monks concerning the following question:

I have set up a textarea form on my site that will enable authors to submit their written contributions to a mySQL database.
How can I make it possible for these guys and gals, if they have rewrites/updates of texts that they have already submitted, to go back and redisplay the form with the information they filled in previously so that all they have to do is institute their changes and resubmit?

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: How to redisplay previously submitted text
by merlyn (Sage) on Apr 25, 2001 at 21:58 UTC
    If you're using the CGI.pm shortcuts (and why shouldn't you?), you can set the default value using the param method:
    use CGI qw/:all/; ... my $previous_value = "This is what I wrote before"; # fetch this someh +ow param('story', $previous_value); # sets default to previous ... print textarea('story'); # prints an input form element, defaulting to + previous value for it
Re: How to redisplay previously submitted text
by arturo (Vicar) on Apr 25, 2001 at 21:51 UTC

    look at the value attribute for text input tags => print "<input type='text' name='bar' value='$bar'>\n";, where $bar is a perl variable containing the value from the DB. Be sure to escape quotes, or risk producing broken HTML. For textareas, all you need to do is put the value in between the opening and closing tag, like so:

    <textarea name="foo" rows=5 cols=80> $foo</textarea>
Re: How to redisplay previously submitted text
by Anonymous Monk on Apr 01, 2003 at 08:12 UTC
    amal homara kebera

    Originally posted as a Categorized Answer.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://75552]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-03-19 07:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found