Problem while submitting FORM data

K

Karuna

Hi

am quite new to Javascript and CGI related stuff.

I have following javascript code :

-----------------------------------------------

<html>
<head>
<script language="JavaScript">
</script>
</head>

<H1> Test Tool </H1>
<HR>


<br>
<b> HPUX Machine List
</br>
</br>
</br>
Select Machine Name:
<select name="hpux_list" size=1>
<option value="one">one
<option value="two">two
<option value="three">three
<option value="four">four
</select>
Install Patch
<Input type="radio" name="hpux_ins" value="Install">
Remove Patch
<Input type="radio" name="hpux_ins" value="Remove">
<input type="submit" value="Go">
</form>
</body>
</html>

-------------------------------------------------------

and following Perl CGI code :

#!/usr/bin/perl -w
#
use strict;
use File::path;
use File::Copy;
use Time::localtime;
use CGI;

use vars qw($cgi_form $f_hpux_install);

#Autoflush.
$| = 1;

# Make sure CGI version 2.46 or above is installed.
eval("use CGI 2.46 qw(-private_tempfiles :standard);");
(print("Error: $@"), exit(-1)) if $@;

# Create CGI object.
$cgi_form = new CGI;


# Read form values and save
#$f_platform = $cgi_form->param('platform');
$f_hpux_install = $cgi_form->param('hpux_ins');


open (TEM, ">temk");
print TEM "the value is $f_hpux_install\n";
close (TEM);

----------------------------------------------

Upon the submission of form with above javascript file
the CGI code should create a file called temk but its not
doing so ?.

Can someone kindly put a light on this as why its not doing so ?.
Its bit urgent !

Thanks in advance
Kbs.
 
R

Richard Cornford

Karuna wrote:
I have following javascript code :

-----------------------------------------------

<html>
<head>
<script language="JavaScript">
</script>

Minimal javascript code in that element.
Upon the submission of form with above javascript file

That is not a javascript file, it is an HTML page that includes
precisely no javascript at all.
the CGI code should create a file called temk
but its not doing so ?.

Can someone kindly put a light on this as why its
not doing so ?. Its bit urgent !

Maybe the question should be asked in a CGI group (or a group related to
the language used). If the form is submitting then the influence of any
javascript on the HTML page (if there was any) would already be over.

Richard.
 
M

Marcel van den Brink

Karuna said:
Hi

am quite new to Javascript and CGI related stuff.
<form method ="POST" name="form"
action="/usr/local/apache/cgi-bin/test.cgi"

I think that here lies your problem. I suppose that you have
configured a webserver and set up a website and also the CGI.
When you ask a browser for your page: e.g. http://localhost/mypage.html
it runs on the webserver. It has no knowledge of files on other directories
(and it should not, otherwise the security risks could be huge).

So my guess is that you should change the action of the form into:

<form method ="POST" name="form" action="/cgi-bin/test.cgi">

I hope that this helps a bit....
Thanks in advance

You're welcome...

-- Marcel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top