Solved

applet parameters

Posted on 2000-04-23
16
1,042 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 1

Expert Comment

by:lambda
Comment Utility
/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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:dapple
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Hope you uploaded the file in ASCII mode.

£.
0
 
LVL 1

Author Comment

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

Author Comment

by:dapple
Comment Utility
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 to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
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 …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now