Problem while submitting FORM data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Karuna

    Problem while submitting FORM data

    Hi

    am quite new to Javascript and CGI related stuff.

    I have following javascript code :

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

    <html>
    <head>
    <script language="JavaS cript">
    </script>
    </head>

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


    <BODY>
    <form method ="POST" name="form" action="/usr/local/apache/cgi-bin/test.cgi"[color=blue]
    >[/color]
    <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">t hree
    <option value="four">fo ur
    </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_tempfil es :standard);");
    (print("Error: $@"), exit(-1)) if $@;

    # Create CGI object.
    $cgi_form = new CGI;


    # Read form values and save
    #$f_platform = $cgi_form->param('platfor m');
    $f_hpux_install = $cgi_form->param('hpux_in s');


    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.
  • Richard Cornford

    #2
    Re: Problem while submitting FORM data

    Karuna wrote:
    <snip>[color=blue]
    > I have following javascript code :
    >
    > -----------------------------------------------
    >
    > <html>
    > <head>
    > <script language="JavaS cript">
    > </script>[/color]

    Minimal javascript code in that element.
    [color=blue]
    > </head>[/color]
    <snip>[color=blue]
    > Upon the submission of form with above javascript file[/color]

    That is not a javascript file, it is an HTML page that includes
    precisely no javascript at all.
    [color=blue]
    > 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 ![/color]

    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.


    Comment

    • Marcel van den Brink

      #3
      Re: Problem while submitting FORM data


      "Karuna" <karu_bs@yahoo. com> wrote in message
      news:88dfb20a.0 408050609.697b4 ede@posting.goo gle.com...[color=blue]
      > Hi
      >
      > am quite new to Javascript and CGI related stuff.
      > <form method ="POST" name="form"[/color]
      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....
      [color=blue]
      > Thanks in advance[/color]

      You're welcome...

      -- Marcel


      Comment

      Working...