ID:277491
 
Code:
#!/usr/local/bin/perl
#
# Author name: Daniel Martin
# Creation date: Tuesday, May 22 2007
#

#Created by Danny Martin
#Perl CGI

use CGI qw( :standard);
$name=param("name");
$msg1=param("message");

#Tell the program that this is the start of an HTML page
print "Content-type:text/html\n\n";

#Create the webpage
print "<html><head><title>Current date and time.</title>";
print "</head>\n<body>";
print scalar( localtime() ); #Use the built in function to get the #current time and print it



print "Message:";
print '<form method="POST" action="final.pl">';
print '<input type="text" name="message">';
print '<input type="submit" value="Post">';
print "</form>";
print '';

#Post the message that they user entered
$msg1=$msg1,$msg;
print $msg1;

#Stop HTML
print "</body></html>";


Whenever the user posts a message, it only posts what they typed up twice. Shouldn't it post the contents of msg1 plus msg, adding msg to msg1 whenever the user posts something else?
I don't see where you're setting the value of $msg, the value of variables isn't persistant across two form submissions. You'll have to store the data in a file or database if you want it to remain persistant.
In response to Nadrew
Ah, ok. I was trying to do this without looking at the book, but comparing what you said with my book, I see how I should've done it.

Gah I feel so stupid. I forgot all about bindings, too.

Thanks!