Solved

applet parameters

Posted on 2000-04-23
16
1,073 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
disabled AD accounts info 3 74
Update a registry value to every user hive 15 81
Recursively Delete Files 5 80
Set robocopy to exclude "System Volume Information" folder 3 54
Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
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…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

770 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