Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

applet parameters

Posted on 2000-04-23
16
Medium Priority
?
1,107 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
[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
  • 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 300 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
Basic Security of Your VPC

So, you’ve got this shiny new VPC and a fancy new application configured on your EC2 servers ready to go. This application is only accessible from your computer, which is great for security, but you need your users to be able to access it! So, what’s the easiest way to do this?

 
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
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…

670 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