CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
simple form question

 



snazzygasm
Deleted

Sep 7, 2000, 7:55 AM

Post #1 of 2 (418 views)
simple form question Can't Post

Hey there! First day in the perl world.
I am trying to get the output of this form to post back to it. I have no idea how to grab the variable. Here is the code I have so far. Can anyone show me how to output the variable 'thename'?

#!/usr/local/bin/perl -w

print "Content-type: text/html\n\n";

use CGI;

$thenames = $form{$thename};

print <<"MakeItStop";
<html>
<title>learning forms</title>
<body>
<form action="learnform2.pl" name="learnit">


what is your name?
<br>
<input type="text" name="thename" value="$thenames">
<input type="submit">
</form>
</body>
</html>
MakeItStop


fashimpaur
User / Moderator

Sep 7, 2000, 8:44 AM

Post #2 of 2 (418 views)
Re: simple form question [In reply to] Can't Post

Snazzygasm,

Just a few minor details missing. I have cut and pasted your code here and commented the changes.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>



#!/usr/local/bin/perl -w

print "Content-type: text/html\n\n";

use CGI;
$q = new CGI; # Added this line
$thenames = $q->param('thename'); # got the variable for use from the CGI environment.

# In print statment:
# Added method to form Tag

print <<"MakeItStop";
<html>
<title>learning forms</title>
<body>
<form action="learnform2.pl" name="learnit" method=POST>

what is your name?
<br>
<input type="text" name="thename" value="$thenames">
<input type="submit">
</form>
</body>
</html>
MakeItStop
</pre><HR></BLOCKQUOTE>

Smile HTH,

Dennis

[This message has been edited by fashimpaur (edited 09-07-2000).]

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives