Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

applet parameters

Posted on 2000-04-23
16
Medium Priority
?
1,125 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 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
[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

 
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

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

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…
Suggested Courses

876 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