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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Help for a newbie

  • 02-02-2007 11:05pm
    #1
    Registered Users, Registered Users 2 Posts: 38


    Hello,
    I'm creating a website for mate for a B&B. I'm relatively new to HTML coding and everything involved but I'm having problems with a form. I have sample code a mate gave me for a form and when I click submit on the web, I keep getting the following error -
    405 Method Not Allowed
    The requested method POST is not allowed for the URL /formmail2.php.


    I have enabled the php on the server side or so I have thought I have. What do you reckon is wrong with this?

    Cheers
    Conor


Comments

  • Registered Users, Registered Users 2 Posts: 865 ✭✭✭generalmiaow


    It's possible that the formmail2.php has to be in the same directory as the file that calls it. Is this the case? Otherwise, you might show us the script itself and I'll test it on a server.


  • Registered Users, Registered Users 2 Posts: 865 ✭✭✭generalmiaow


    In fact, while you're at it, post the HTML from the form you've written. (use the "php" button when you're typing your text [PHP]so it will show up like this[/PHP] )


  • Registered Users, Registered Users 2 Posts: 38 Dj shaft


    Here is the link to the form webpage - http://www.ardrihouse.com/ardri/student_survey_draft2.htm

    [PHP]<html>
    <head>
    <title>Thank You</title>

    </head>

    <BODY>
    <center>
    <table border="0" height="90%" width="100%">
    <tr>
    <td height="100%" valign="top">

    <center><b>The following information has been sent to the relevant persons
    </center><hr width=550>

    <?
    ###########################################
    #Very simple PHP formmail script.
    #Script send datas like ip Phone and remote host.
    #Also after posting details it thanks user for posting.
    ###########################################

    $mail='conorwalshe@hotmail.com'; //Tommy put the feedback address here (ive put your in already)
    $subject="Pitman Training User / Student Survey Response"; //Change subject here
    $thank="thank.htm"; //Your thank you page
    $min_size="10"; //Minimum length of Message
    $max_size="1000"; //Maximum length of Message
    $telsize=12; //size of tel Phone
    $max_tel_size=20; //maximum size of tel. Phone.
    $banlist=""; //if you do not want some ips to spam you add them here.

    //You can change error Messages here

    //$no_Phone="You forgot to write your tel Phone."; //If tel Phone is forgotten
    //$no_Message="You forgot to write your Message"; //If Message is forgotten
    //$no_realname="You forgot to write your realname"; //If no realname
    //$mail_error="Your mail is wrong. Check this."; //If mail is wrong
    //$Phone_error="Your tel Phone is wrong. Check this"; //If Phone is wrong
    //$max_error="Your Message is too long"; //If Message is long.
    //$min_error="Your Message is too short"; //If Message is short.
    //$banned="You cant send me Message because you are BANNED!!"; //if banned.

    //here is error page parameters.

    $error_title="wrong parameters"; //title of page
    $back='#0000cc'; //background of error page
    $text='#ffffff'; //text colour of error page
    $h2='#ccccc'; //heading colour of error page
    $error_Message="the folowing fields are wrong please check them."; //Message for visitor.
    $ip=$_SERVER;
    //Nothing else to change leave it as is.
    $result=1;


    // These are the items posted from the form. If you edit the form you must edit the these value accordinly, dont put spaces in form post items i.e. below is the value $movies = $_POST[Movies]; if that was $movies = $_POST[Movies I Like]; you will receive a parse error

    $realname = $_POST[visitor_name];
    $email = $_POST[visitor_email_address];
    $where = $_POST[Where];
    $movies = $_POST[Movies];
    $joke = $_POST[name];
    $Message = $_POST[Comment];
    $HTTP_USER_AGENT = $_SERVER;
    $HTTP_VIA = $_SERVER;
    $REMOTE_HOST = $_SERVER;
    $HTTP_HOST = $_SERVER;
    $SERVER_ADDR = $_SERVER;
    $SCRIPT_FILENAME = $_SERVER;


    $mailbody.="Name: $realname\n\n";
    $mailbody.="E-Mail : $email\n\n";
    $mailbody.="Where do you want to go today?:\n $where\n\n";
    $mailbody.="What kind of movies do you like?:\n $movies\n\n";
    $mailbody.="How many salesman does it take to change a light bulb?:\n $joke\n\n";
    $mailbody.="Comments : \n$Message\n\n\n";

    if ($result==1){
    mail($mail,$subject,$mailbody,"From: $realname<$email>\n");
    //mail($email,$subject,$mailbody,"From: $mail\n");
    //Header ("Location: $thank");
    echo "<center><table border=0 cellspacing=0 cellpadding=0 width=550>
    <tr><td><b>Name: </b>" . $realname . "<br><br>";
    echo "<b>Where do you want to go today?: </b>" . $where . "<br><br>";
    echo "<b>What kind of movies do you like? : </b>" . $movies . "<br><br>";
    echo "<b>How many salesman does it take to change a light bulb? : </b>" . $joke . "<br><br>";
    echo "<b>Comments : </b><br>" . $Message . "<br><br></td></tr></table>";
    }
    if ($result!==1){
    echo ("<body bgcolor=$back text=$text><title>$error_title</title>
    <center><h2><font color='$h2'>$error_Message</font></h2></center><ol>$error$error1$error2$error3$error4
    $error5$error6$error7</ol></center></body>");
    }

    ?>

    </td>
    </tr>
    </table>

    </div>
    </body>
    </html>[/PHP]


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    Is the /ardri/formmail2.php in the same directory?

    put this code at the very top of your page:

    [php]
    <?php
    if(isset($_POST)){//check to see if the form is submited
    ?>
    <table border="0" height="90%" width="100%">
    <tr>
    <td height="100%" valign="top">

    <center><b>The following information has been sent to the relevant persons
    </center><hr width=550>

    <?
    ###########################################
    #Very simple PHP formmail script.
    #Script send datas like ip Phone and remote host.
    #Also after posting details it thanks user for posting.
    ###########################################

    $mail='conorwalshe@hotmail.com'; //Tommy put the feedback address here (ive put your in already)
    $subject="Pitman Training User / Student Survey Response"; //Change subject here
    $thank="thank.htm"; //Your thank you page
    $min_size="10"; //Minimum length of Message
    $max_size="1000"; //Maximum length of Message
    $telsize=12; //size of tel Phone
    $max_tel_size=20; //maximum size of tel. Phone.
    $banlist=""; //if you do not want some ips to spam you add them here.

    //You can change error Messages here

    //$no_Phone="You forgot to write your tel Phone."; //If tel Phone is forgotten
    //$no_Message="You forgot to write your Message"; //If Message is forgotten
    //$no_realname="You forgot to write your realname"; //If no realname
    //$mail_error="Your mail is wrong. Check this."; //If mail is wrong
    //$Phone_error="Your tel Phone is wrong. Check this"; //If Phone is wrong
    //$max_error="Your Message is too long"; //If Message is long.
    //$min_error="Your Message is too short"; //If Message is short.
    //$banned="You cant send me Message because you are BANNED!!"; //if banned.

    //here is error page parameters.

    $error_title="wrong parameters"; //title of page
    $back='#0000cc'; //background of error page
    $text='#ffffff'; //text colour of error page
    $h2='#ccccc'; //heading colour of error page
    $error_Message="the folowing fields are wrong please check them."; //Message for visitor.
    $ip=$_SERVER;
    //Nothing else to change leave it as is.
    $result=1;


    // These are the items posted from the form. If you edit the form you must edit the these value accordinly, dont put spaces in form post items i.e. below is the value $movies = $_POST[Movies]; if that was $movies = $_POST[Movies I Like]; you will receive a parse error

    $realname = $_POST[visitor_name];
    $email = $_POST[visitor_email_address];
    $where = $_POST[Where];
    $movies = $_POST[Movies];
    $joke = $_POST[name];
    $Message = $_POST[Comment];
    $HTTP_USER_AGENT = $_SERVER;
    $HTTP_VIA = $_SERVER;
    $REMOTE_HOST = $_SERVER;
    $HTTP_HOST = $_SERVER;
    $SERVER_ADDR = $_SERVER;
    $SCRIPT_FILENAME = $_SERVER;


    $mailbody.="Name: $realname\n\n";
    $mailbody.="E-Mail : $email\n\n";
    $mailbody.="Where do you want to go today?:\n $where\n\n";
    $mailbody.="What kind of movies do you like?:\n $movies\n\n";
    $mailbody.="How many salesman does it take to change a light bulb?:\n $joke\n\n";
    $mailbody.="Comments : \n$Message\n\n\n";

    if ($result==1){
    mail($mail,$subject,$mailbody,"From: $realname<$email>\n");
    //mail($email,$subject,$mailbody,"From: $mail\n");
    //Header ("Location: $thank");
    echo "<center><table border=0 cellspacing=0 cellpadding=0 width=550>
    <tr><td><b>Name: </b>" . $realname . "<br><br>";
    echo "<b>Where do you want to go today?: </b>" . $where . "<br><br>";
    echo "<b>What kind of movies do you like? : </b>" . $movies . "<br><br>";
    echo "<b>How many salesman does it take to change a light bulb? : </b>" . $joke . "<br><br>";
    echo "<b>Comments : </b><br>" . $Message . "<br><br></td></tr></table>";
    }
    if ($result!==1){
    echo ("<body bgcolor=$back text=$text><title>$error_title</title>
    <center><h2><font color='$h2'>$error_Message</font></h2></center><ol>$error$error1$error2$error3$error4
    $error5$error6$error7</ol></center></body>");
    }

    ?>

    </td>
    </tr>
    </table>

    </div>

    <?php
    exit();
    die();
    }//end if form was submited
    ?>
    [/php]

    and see if it works.
    Also change the form action to the same page the the form is "student_survey_draft2.htm" changing .htm to .php


  • Registered Users, Registered Users 2 Posts: 38 Dj shaft


    Yep the formmail2.php is in the same directory as the form htm page


  • Advertisement
  • Closed Accounts Posts: 1,200 ✭✭✭louie


    did you try the code above?
    can you run php code on your server?


  • Registered Users, Registered Users 2 Posts: 38 Dj shaft


    How can I test whether I can run php on my server? I have switched it on in the server set control panel up last Friday.

    I tried the code all right but same error!!


  • Closed Accounts Posts: 7,145 ✭✭✭DonkeyStyle \o/


    Dj shaft wrote:
    How can I test whether I can run php on my server?
    Very simply...
    [php]<?php
    phpinfo();
    ?>[/php]
    Paste that into a text file, give it a php extension, upload it to the server, open it in a browser... you'll know if it's worked when you see lots of stats.


  • Registered Users, Registered Users 2 Posts: 38 Dj shaft


    Cheers lads for all the help but this problem is down to stupidity on my behave! I never clicked the apply button on the control panel after switching php on! I won't forget next time.

    Now all I have to do is adapt that form to one I want to use for a bed and breakfast. I might have a few more questions on this.

    Cheers again and sorry for wasting your time.


Advertisement