+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Html forms not working-cgi prob?

  1. #1
    ReeRee's Avatar
    ReeRee is offline x10Hosting Member ReeRee is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    6

    Unhappy Html forms not working-cgi prob?

    HI all! I am having issues with my webpage and am too frustrated to think of an answer :rant2:. I read all the posts on similar probs I could find, most were resolved and said start new thread, so I am doing just that.

    First, a brief synopsis of what I am going for with the page: I have some html forms and a perl cgi script. The script should take the input of the forms, and 'print' it to a txt file. That file then is displayed at the bottom of said page using CSS.

    I have the forms in place, a script that SHOULD work, and the txt file displayed. The problem is: the cgi is doing nothing. I can't seem to figure this out :dunno:. I checked and rechecked the code (an area I am not too comfortable with in the first place) and it seems fine. I tried looking into the Perl mods on CPX, but that only confused me more. I even tried to go a different route with php/mysql, and after 5 hours of pulling hair I said :thefinger that.

    Am I missing other components? Does my script need work? Is it my html? I have no clue. PLM is the page.

    My Perl script is the cgi-bin subfolder of public_html and reads:
    Code:
    #!/usr/bin/perl
     
    use strict;
    use warning;
    use diagnostics;
     
    use CGI;
    my $cgi = CGI->new;
    my $name = $cgi->param('name');
    my $class = $cgi->param('class');
    my $level = $cgi->param('level');
     
    open(outputfile,"/kos.txt"); 
    print (outputfile "$name \n<br>  $class \n<br> $level \n<br>");
    close(outputfile);
     
    print "Location: plmkos.html\n\n";
    exit;
    What other info (if any) do I need to post? Am I even in the right forum?
    Any and all help is most welkum.
    Thanks!

  2. #2
    LHVWB's Avatar
    LHVWB is offline Lord Of The Keys LHVWB is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Australia
    Posts
    1,308

    Re: Html forms not working-cgi prob?

    * Moved to Programming Help, this is where you should post for any programming related issues. If you think that there is a problem with your account then you can post back in the free hosting support section, but that is generally reserved for account issues because normal users can't post to help you there.

    Good luck!

  3. #3
    Jose Magsino is offline x10Hosting Member Jose Magsino is an unknown quantity at this point
    Join Date
    Jan 2008
    Posts
    53

    Re: Html forms not working-cgi prob?

    Change this :

    Code:
    open(outputfile,"kos.txt");
    to

    Code:
    open(outputfile,">kos.txt");
    That should solve your problem..



    Also I've noticed that you are using / there which points to root directory..
    I hope you have permission to that directory.

    HTH
    Last edited by Jose Magsino; 04-27-2008 at 04:23 AM.

  4. #4
    ReeRee's Avatar
    ReeRee is offline x10Hosting Member ReeRee is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    6

    Re: Html forms not working-cgi prob?

    Unfortunately that change had no effect. The page does nothing still. As for permissions, how do I check that?

    Thanks for your help.

    Edit: Thanks for the move Verb :D
    Last edited by ReeRee; 04-28-2008 at 11:04 PM.

  5. #5
    bugfinder's Avatar
    bugfinder is offline Retired bugfinder is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    2,260

    Re: Html forms not working-cgi prob?

    If you go into the file manager and select the file theres a permissions icon at the top.
    :rant2:
    Please do not send me personal messages unless I have requested you to do so.
    Thank you.

    You can join us on irc for support and chat
    2 - connnect to irc either by the web interface or direct irc://irc.x10hosting.com:6667

  6. #6
    Jose Magsino is offline x10Hosting Member Jose Magsino is an unknown quantity at this point
    Join Date
    Jan 2008
    Posts
    53

    Re: Html forms not working-cgi prob?

    What i'm referring to on the permission is that you are using / on your code. This / thing points you to the root directory.

    Code:
    open(outputfile,"/kos.txt");
    Are you sure that your account has permission access that / directory? If you dont have access then please use other directory (you may use /home/youraccountname/) in which you are allowed to or simply remove that '/' character.

    And also as bugfinder said, maybe the script you made doesnt have permission to execute, please follow what he said, change its permission to 755.

    HTH.
    Last edited by Jose Magsino; 04-29-2008 at 03:22 AM.

  7. #7
    ReeRee's Avatar
    ReeRee is offline x10Hosting Member ReeRee is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    6

    Re: Html forms not working-cgi prob?

    Ok, now I know to what you were referring, all is as it should be. The root dir is the public_html folder, so yeah permission granted. As for the other permissions, all were/are set to 755.

    Is there something else I need to include in the script folder other than the script itself?

    Thanks again for your support.
    Last edited by ReeRee; 04-29-2008 at 12:35 PM.

  8. #8
    marshian's Avatar
    marshian is offline x10 Elder marshian is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Belgium
    Posts
    526

    Re: Html forms not working-cgi prob?

    I know nothing of perl at all, but are you sure the root dir is public_html?
    as far as i know, public_html is /home/yourname/public_html
    Real programmers don't document their code - if it was hard to write, it should be hard to understand.

  9. #9
    ReeRee's Avatar
    ReeRee is offline x10Hosting Member ReeRee is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    6

    Re: Html forms not working-cgi prob?

    Tried changing all the directories, to no avail. really frustrated atm. Maybe I should give php/mysql another shot? any other suggestions?

  10. #10
    woiwky is offline x10 Lieutenant woiwky is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    390

    Re: Html forms not working-cgi prob?

    First, your html is a little messed up. You have the submit image after the closing <form> tag, so that won't submit. Also, you specify the form's action as:

    http://plm.pcriot.com/home/reeree/pu.../submit_kos.pl

    You need to change that to '/cgi-bin/submit_kos.pl'. Lastly, you use the names 'Class' and 'Level' in the html, but you use 'class' and 'level' in the script.

    And as for the script, you're missing the 's' in "use warnings;" for one. Second, you need to change

    open(outputfile,"/kos.txt");

    to

    open(outputfile,">../kos.txt");

    to specify that you want to rewrite the file and to navigate out of the cgi-bin directory. And you should also change the redirection to:

    print "Location: http://plm.pcriot.com/plmkos.html\n\n";

    Those changes *should* fix it.
    "But you have access to the greatest source of knowledge in the universe."
    "Well I do talk to myself sometimes, yes."

    "I'm back, and I'm bad! Obviously within certain, sensible, preset parameters"

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. DHMTL dragable window not working.
    By Genius_boy001 in forum Programming Help
    Replies: 2
    Last Post: 03-02-2008, 02:08 PM
  2. Help with adding HTML TO site and large pages
    By skyfall in forum Free Hosting
    Replies: 7
    Last Post: 02-14-2008, 07:54 AM
  3. Some HTML not working
    By erica12 in forum Free Hosting
    Replies: 2
    Last Post: 02-05-2008, 12:29 AM
  4. [IPB] Contiguous Board Index
    By phenetic in forum Tutorials
    Replies: 5
    Last Post: 09-18-2005, 10:31 AM
  5. What is XML!
    By wizeman in forum Tutorials
    Replies: 6
    Last Post: 08-27-2005, 12:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers