You are trying to assign a static value to something that comes from the
form. If you create a field called "comments" (or anything you want to call
it, that's just what I chose) on your form and then type your test string,
it will work with the following change to your code:

==================================================

#!/usr/bin/perl -wT
use CGI;
use CGI::Carp 'fatalsToBrowser';
use strict;

my $q = new CGI;
my $test = $q->param('comments'); # Dynamic value rather
                                            # than a static one

print $q->header("text/html"),
      $q->start_html,
      $q->p("Hello! " . $test . " Did it work?"),
      $q->end_html;

=================================================

Now, on your form, type "This is a test!" into your comments box and see
what results you get. Betcha it works this time.

If you wanted $test to always have a static value (I'm not sure why you
would, but then again I don't know your application), you could have just
set

my $test = "This is a test!";


Scot R.
inSite Internet Solutions
[EMAIL PROTECTED]
http://www.insiteful.tv



-----Original Message-----
From: Hughes, Andrew [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 24, 2002 10:20 AM
To: [EMAIL PROTECTED]
Subject: Object oriented variable question


When using cgi.pm object oriented method, how do I assign a static value to
a variable and then output it?  The test script that I listed below prints
all of the html tags with "Hello!Did it work?" (without the quotes) in the
paragraph tags.  Also, in my error log there is the following error:

index.cgi: Use of uninitialized value in concatenation (.) or string at
index.cgi line 9.

==================================================

#!/usr/bin/perl -wT
use CGI;
use CGI::Carp 'fatalsToBrowser';
use strict;

my $q = new CGI;
my $test = $q->param("This is a test!");

print $q->header("text/html"),
      $q->start_html,
      $q->p("Hello!" . $test . "Did it work?"),
      $q->end_html;

=================================================

Thanks for your help!
Andrew

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.370 / Virus Database: 205 - Release Date: 6/5/2002

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.370 / Virus Database: 205 - Release Date: 6/5/2002


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to