+
+if ($textid eq 'new') {
+ my $textid = time;
+ my $ntextq = $dbh->prepare("SELECT textid FROM texts".
+ " ORDER BY textid DESC LIMIT 1");
+ $ntextq->execute();
+ my $ntextrow = $ntextq->fetchrow_hashref();
+ if ($ntextrow) {
+ my $mintextid = $ntextrow->{'textid'} + 1;
+ $textid = $mintextid if $textid < $mintextid;
+ }
+}
+
+my $dinsertq = $dbh->prepare("INSERT INTO texts (textid, desc, subject, text)".
+ " VALUES (?,?,?,?)");
+$dinsertq->execute($textid, $desc, $subject, $text);
+
+db_commit();
+
+</%perl><& htmlhead, subpage => "Saved \"$desc\"" &>
+Message and configuration saved.
+<p>
+<form action="main" method="get">
+<input type="submit" value="OK">
+</form>