PDA

View Full Version : Where does the form go


steevojb
08-23-2006, 09:58 AM
Hi everyone

I am writing a configuration utility for my masters degree. This is the first time I have used perl/cgi/MySQL so learning as I go along

I have written a perl/cgi script that connects to my database and pulls information from tables. Next I want to write some forms to allow the user to add data to the tables.

I am reading MySQL for Perl and the Web by Paul DuBois.

The question I am asking is, where does the form go ?

<form method="post" action=enterIntotblHost.pl">
Host Table List:<br>
<textarea name="content" rows=3 cols=80></textarea><br>
<input type="submit" name="choice" value="Submit">
</form>

Do I source it from the script enterIntotblHost.pl ? If I add it to the script enterIntotblHost.pl perl simply generates tonnes of errors

TIA

Steve

steevojb
08-23-2006, 01:12 PM
clearly do not know what i'm doing. I have generated the form in the cgi script

sub display_entry_form

{
print start_form (-action => url ()),
"Host Table List:", br (),
textarea ( -name => "content",

-value => "",
-override => 1,
-rows => 3,
-columns => 80),
br (),
submit (-name => "choice", -value => "Submit"),
end_form ();
}

Steve

DELOCH
08-23-2006, 04:51 PM
simple...


print << "EOF";
<form method="post" action=enterIntotblHost.pl">
Host Table List:<br>
<textarea name="content" rows=3 cols=80></textarea><br>
<input type="submit" name="choice" value="Submit">
</form>
EOF


Thats it ^_^

FishMonger
08-23-2006, 06:54 PM
Steve,

You can do it the way DELOCH shows, but the subroutine you posted is IMO a better method. The only change I'd make, and this is only a matter of personal preference of style, would be to use single quotes instead of the double quotes unless I need to do variable interpolation.