Solved

applet parameters

Posted on 2000-04-23
16
1,089 Views
Last Modified: 2013-12-25
I am looking for a perl script to do the following:
The user enters their name in a text box and chooses between two values from radio buttons, for gender either male or female.Then after they submit, the script will right two applet param to the web page like
<PARAM name=nick value=whatever>
<PARAM name=sex value=male or female>
The rest of the page will be written at the same time also .Here is the full page:
<HTML><TITLE>AppledoreChat version 1</TITLE>
<BODY BGCOLOR="WHITE">
<CENTER>
<APPLET CODE="ChatGUI" WIDTH=625 HEIGHT=450  
CODEBASE="" ARCHIVE="">
<PARAM NAME="NICK" VALUE="dee">
<PARAM NAME="SEX" VALUE="MALE">
<PARAM NAME="SERVER" VALUE="11.11.11.11">
</APPLET>
</CENTER>
Please leave your comments in the <a href="addguest.html">guestbook</a>
<HR>
<center>
</BODY></HTML>
I hope you get what i mean i tried to explain thoroughly.Please can you provide full source if possible because I dont know much perl.The server im using has perl 5.05 i think with CGI.pm installed.

David
0
Comment
Question by:dapple
  • 12
  • 3
16 Comments
 
LVL 1

Expert Comment

by:lambda
ID: 2742786
I suppose this is what you want...


HTML
----

<html>
<body>
<form action="/cgi-bin/j_test.cgi" method="POST">
Enter Nick Name: <input type="text" name="nick">
<br>
Sex: <input type="radio" name="sex" value="male" checked>
<input type="radio" name="sex" value="female">
<br>
<input type="submit" value="Submit">
</form>
</body></html>


j_test.cgi
----------

#!/usr/bin/perl
use CGI qw (param);

$nick = param("nick");
$sex = param("sex");

print <<END_OF_HTML;

<HTML><TITLE>AppledoreChat version 1</TITLE>
<BODY BGCOLOR="WHITE">
<CENTER>
<APPLET CODE="ChatGUI" WIDTH=625 HEIGHT=450   CODEBASE="" ARCHIVE="">
<PARAM NAME="NICK" VALUE="$nick">
<PARAM NAME="SEX" VALUE="$sex">
<PARAM NAME="SERVER" VALUE="11.11.11.11">
</APPLET>
</CENTER>
Please leave your comments in the <a href="addguest.html">guestbook</a>
<HR>
<center>
</BODY></HTML>

END_OF_HTML
;

£.
0
 

Accepted Solution

by:
venky75 earned 150 total points
ID: 2742804
Hi,

The CGI script u would have to use is(if cgi.pm is installed as is ur case):

#!/usr/bin/perl
use CGI;
$getcgi=new CGI;
$nick=$getcgi->param("nick");
$sex=$getcgi->param("sex");

print "Content-type: text/html\n\n";
print <<HTMLOUT;
<HTML>
<TITLE>AppledoreChat version 1</TITLE>
<BODY BGCOLOR="WHITE">
<CENTER>
<APPLET CODE="ChatGUI" WIDTH=625 HEIGHT=450 CODEBASE="" ARCHIVE="">
<PARAM NAME="NICK" VALUE=$nick>
<PARAM NAME="SEX" VALUE=$sex>
<PARAM NAME="SERVER" VALUE="11.11.11.11">
</APPLET>
</CENTER>
Please leave your comments in the <a href="addguest.html">guestbook</a>
<HR>
<center>
</BODY>
</HTML>
HTMLOUT
exit ;

Make sure the .cgi/.pl file is stored in cgi-bin directory and the form u use for submitting is:

<form method="post" action="/cgi-bin/somename.cgi">
Name :<input type="text" name="nick"><br>
Sex :<input type="radio" name="sex" value="male">Male
<input type="radio" name="sex" value="female">Female<br>
</form>

I hope this solves ur problem.

Bye
Venky
0
 
LVL 1

Author Comment

by:dapple
ID: 2743239
i get this error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

It is using Apache/1.3.11 Server
I have set the correct rights on the file read and execute and its in the
cgi-bin directory
I changed the action to point to the correct place. Any ideas
I tried both scrpts, they do not work.
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
LVL 1

Expert Comment

by:lambda
ID: 2743263
/usr/bin/perl might not be the correct path on your server. Or else CGI module may not be installed.

£.
0
 
LVL 1

Author Comment

by:dapple
ID: 2743285
i did this
perl -cw choice.cgi
to look at error
it says following error

Can't find string terminator "HTMLOUT" anywhere before EOF at choice.cgi line 8

also i did which perl to get path, it printed:
/usr/local/bin/perl


0
 
LVL 1

Author Comment

by:dapple
ID: 2743290
i changed the path in the script still same error
could it be because the script was created in windows NT then uploaded to unix be a problem?
0
 
LVL 1

Author Comment

by:dapple
ID: 2743298
the cgi module is installed because i used other scripts with it, that use it
a guestbook and some test files
0
 
LVL 1

Author Comment

by:dapple
ID: 2743308
I know windows puts CRLF at end of files and unix puts LF, could this be the problem, how to convert the windows file to unix
The other scripts that work, were already created so maybe thats why they work, this is the only one that was created under windows.
0
 
LVL 1

Author Comment

by:dapple
ID: 2743310
I know windows puts CRLF at end of files and unix puts LF, could this be the problem, how to convert the windows file to unix
The other scripts that work, were already created so maybe thats why they work, this is the only one that was created under windows.
0
 
LVL 1

Author Comment

by:dapple
ID: 2743314
I know windows puts CRLF at end of files and unix puts LF, could this be the problem, how to convert the windows file to unix
The other scripts that work, were already created so maybe thats why they work, this is the only one that was created under windows.
0
 
LVL 1

Author Comment

by:dapple
ID: 2743315
I know windows puts CRLF at end of files and unix puts LF, could this be the problem, how to convert the windows file to unix
The other scripts that work, were already created so maybe thats why they work, this is the only one that was created under windows.
0
 
LVL 1

Author Comment

by:dapple
ID: 2743320
I know windows puts CRLF at end of files and unix puts LF, could this be the problem, how to convert the windows file to unix
The other scripts that work, were already created so maybe thats why they work, this is the only one that was created under windows.
0
 
LVL 1

Author Comment

by:dapple
ID: 2743326
I know windows puts CRLF at end of files and unix puts LF, could this be the problem, how to convert the windows file to unix
The other scripts that work, were already created so maybe thats why they work, this is the only one that was created under windows.
0
 
LVL 1

Expert Comment

by:lambda
ID: 2743398
Hope you uploaded the file in ASCII mode.

£.
0
 
LVL 1

Author Comment

by:dapple
ID: 2743430
It was on auto detect
I tried in ASCII still does not work
what goes on?
0
 
LVL 1

Author Comment

by:dapple
ID: 2743784
i changed HTMLOUT to EOF
and it works, why would this make a difference i thought any id could be used
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Linux Scripting 3 165
Powershell Script need assistance to make some changes 4 99
New-MoveRequest Exchange 2010 Powershell 1 39
Powershell Split 18 29
Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
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 …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

756 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