Solved

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

Posted on 1998-08-21
2
173 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

734 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