[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 1998-08-21
2
Medium Priority
?
178 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 40 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

649 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