Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Submit HTML form using PHP

Options
  • 28-07-2009 12:57pm
    #1
    Registered Users Posts: 941 ✭✭✭


    I have been trying to get a form working using Perl script on a site I am working on but to no avail. I am looking into geting it to work using PHP. Only problem is I have no PHP knowledge. Can anybody help me? This is the form code:
    <form id="mailing-list" name="mailing-list" method="post" action="cgi-bin/FormMail.pl">
    <input type="hidden" name="subject" value="Send me a Newsletter" />
    <input type="hidden" name="redirect" value="http://www.visualcarlow.ie/thank-you.html" />
    <input type="hidden" name="recipient" value="info@visualcarlow.ie">
    <input type="hidden" name="required" value="your-email" />
    <input name="your-email" type="textfield" class="your-email" id="your-email" value="Join our Mailing List" />
    <input type="submit" class="formbutton" name="submit" id="submit" value="Submit" />
    </form>
    

    Thanks.


Comments

  • Registered Users Posts: 6,494 ✭✭✭daymobrew


    What errors are you getting?
    It is not finding the FormMail.pl script? Why are you changing from perl, which you know, to PHP, which you don't know?
    Does the form display alright in the browser? (that should be the first step).

    Also, the form as is could be used to spam people because the recipient is in the form (as mentioned in another thread).


  • Registered Users Posts: 941 ✭✭✭CyberDave


    I get the following error:
    Error occurred: 500 - internal server error


    It gets to the FormMail script alright but it doesn't execute it, as I am not redirected to the redirect page. The Form looks grand in the browser. The reason I am thinking of trying to get it to work using PHP is desperation really, I have been trying to get this to work for a few days now, on and off but cannot get it to work.


  • Registered Users Posts: 6,494 ✭✭✭daymobrew


    CyberDave wrote: »
    I get the following error:
    Error occurred: 500 - internal server error
    Check your server logs. It could be something as simple as the permissions on the script (it might not be executable).

    What if you go to the cgi-bin/FormMail.pl script directly? (I expect the same error).
    Is the path to perl correct? (try a basic Hello World script to prove it)
    Is perl available on the server?

    PS, it might be better to use a different script. I use FormMail (PHP) though it is tedious to set up (because it is complex and powerful).


  • Registered Users Posts: 941 ✭✭✭CyberDave


    daymobrew wrote: »
    Check your server logs. It could be something as simple as the permissions on the script (it might not be executable).

    It is recommended to use permissions 755, which I have set it to.
    daymobrew wrote: »
    What if you go to the cgi-bin/FormMail.pl script directly? (I expect the same error).

    Yeah. Same error.
    daymobrew wrote: »
    Is the path to perl correct? (try a basic Hello World script to prove it) Is perl available on the server?

    Not sure how to test using Hello World Script.
    daymobrew wrote: »
    PS, it might be better to use a different script. I use FormMail (PHP) though it is tedious to set up (because it is complex and powerful).

    I would like to try this, but like I said I have no PHP experience. I better try and get the Perl script working.


  • Registered Users Posts: 6,494 ✭✭✭daymobrew


    CyberDave wrote: »
    Not sure how to test using Hello World Script.
    Use this (from Apache docs):
    #!/usr/bin/perl
    print "Content-type: text/html\n\n";
    print "Hello, World.";
    


  • Advertisement
  • Registered Users Posts: 941 ✭✭✭CyberDave


    Tried the Hello World script above but still get the same error:
    Error occurred: 500 - internal server error


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    What I would do here is do a simple print at the first line of the perl script and exit to see if you even getting to the script and executing it.

    I know this is quite obvious and unlikely to be the problem here, but assuming it a *nix server, your file names and paths are case sensitive.

    Make sure everything here is checked: http://www.thesitewizard.com/archive/servererror.shtml


  • Registered Users Posts: 6,494 ✭✭✭daymobrew


    CyberDave wrote: »
    Tried the Hello World script above but still get the same error:
    Error occurred: 500 - internal server error
    It is probably time to ask Support at your hosting provider.


  • Registered Users Posts: 941 ✭✭✭CyberDave


    daymobrew wrote: »
    It is probably time to ask Support at your hosting provider.

    I've asked them alright, but they haven't been much help.


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    Well they should be of help, it's their job and their responsibility. Get them to prove to you that perl is working.


  • Advertisement
  • Registered Users Posts: 941 ✭✭✭CyberDave


    Well got it working evetnually. It was a permissions issue with the CGI bin. Thanks for yer help.


Advertisement