Solved

User input does not appear on my CGI program's response page

Posted on 1998-08-21
2
169 Views
Last Modified: 2013-12-25
I have a form to email program. Everything works except I can't seem to make the user's name (which is input through the form) appear on the CGI program's acknowledgement page to the user. The variable I used is called username. I  thought I could get the value of this by simply typing $username:

#within a sub-program
print "Content-type: text/html\n\n";
print<<"(ENDOFACK)";
<HTML>
<HEAD>
<TITLE>Acknowledgement</TITLE>
</HEAD>
<BODY>Thank you, $username!</BODY>
</HTML>
(ENDOFACK)


The response page that results is:

Thank you, !

Can someone help?
0
Comment
Question by:zgee
2 Comments
 
LVL 1

Accepted Solution

by:
RoboBob earned 10 total points
ID: 1828259
You probably arent defining $username anywhere, try this simple script, which should give you an idea what you need to do...

#!/usr/local/bin/perl -w
use CGI;

$cgi = new CGI;

print <<"END";
Content-Type: text/html

<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>
<BODY>
END

if($cgi->param) {
    print "Thank you, ".$cgi->param('username')."!\n";
} else {
print <<"END";
<FORM METHOD=POST ACTION="$ENV{'SCRIPT_NAME'}">
Username: <INPUT TYPE=TEXT NAME=username><BR>
<INPUT TYPE=SUBMIT>
</FORM>
END
}

Also take a look at the CGI documentation ('perldoc CGI').
0
 

Author Comment

by:zgee
ID: 1828260
Thanks, Robobob. You were right. I missed out the definition of $username in my script.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now