471,354 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

Problem while submitting FORM data

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>
<BODY>
<form method ="POST" name="form" action="/usr/local/apache/cgi-bin/test.cgi"

<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.
Jul 23 '05 #1
2 1316
Karuna wrote:
<snip>
I have following javascript code :

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

<html>
<head>
<script language="JavaScript">
</script>
Minimal javascript code in that element.
</head> <snip> 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.
Jul 23 '05 #2

"Karuna" <ka*****@yahoo.com> wrote in message
news:88**************************@posting.google.c om...
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
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Wysiwyg | last post: by
1 post views Thread by gzannd | last post: by
7 posts views Thread by mohammed.naghman | last post: by
4 posts views Thread by Harry | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.