Solved

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

Posted on 1998-08-21
2
168 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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 tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to count occurrences of each item in an array.

747 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

9 Experts available now in Live!

Get 1:1 Help Now