Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy I have a simple form. What am I missing?

    I'm setting up a very simple form on my website http://www.customcaptures.com/pricing.htm I've tried about 5 or 6 php scripts that i've placed with the web files on my ftp and changed the few lines of script to point to my email and thank you page when complete. The form is set up to be processed through the php formail script - no problem there. So, when I try it and click submit, each time I get an error 405 (The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access). I know that it has something to do with my server (through 1and1.com) because some of the php form scripts I've tried reside on other servers and they work(but I don't want to use those because they cost money or have unwanted links). Anybody have any ideas?

    I should note that all I have uploaded to the server are: my html pages, images, and that php script. I have no idea what perl, mysql, cgi, apache, asp, ssl, iis are but I keep seeing all these in the forums I've read through related to this problem. Is there something extra that I need to add to my server space in order for this php script to function?

    HELP!

  • #2
    Regular Coder Tyree's Avatar
    Join Date
    Sep 2003
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts
    First question is does your server allow you to use php?

    If yes, show us the code for your email script. Then we can begin to troubleshoot.

    Your form doesn't look like anything out of the ordinary, so I doubt that's causing a problem.
    Matt Tyree
    TyreeOnline
    If I didn't just "make it worse," show me some love! Hit me with the rep points! :) (The white scales icon on the left)

  • #3
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Tyree View Post
    First question is does your server allow you to use php?

    If yes, show us the code for your email script. Then we can begin to troubleshoot.

    Your form doesn't look like anything out of the ordinary, so I doubt that's causing a problem.
    That's a good question. I tried to figue out if they do allow php and from what I can see, it comes with every package. This script IS located in the cgi-bin file. I also had a rediredcted home page. I figured that might be a problem so I replaced my site in the main '/' directory just in case.

    This is one of the many free interent scripts i've tried for forms...

    PHP Code:
    <?php
    // FORM TO EMAIL  Dec 27th 2005
    // http://www.webformdesigner.com
    // The following variables can be changed to suit

    // NOTE: In order for the resulting mail message to you to contain the
    // relevant information, your form should ideally contain, amongst others,
    // two fields called "name" and "email" respectively (note lower case)
    // for capturing the user's name & email address

    // Change this to the email address where the message is to be sent
    $your_email "info@customcaptures.com";

    // This is the return URL after the form has been processed
    $thankyou "http://www.customcaptures.com/thankyou.htm";

    // This is what is displayed in the email subject line
    // Change it if you want
    $subject "Contact Form";


    // You shouldn't need to edit below this line
    // ---------------------------------------------
    $name trim(stripslashes($_POST['name']));
    $email trim(stripslashes($_POST['email']));
    $year date("Y");
    $month date("m");
    $day date("d");
    $hour date("h");
    $min date("i");
    $tod date("a");

        
    // Timestamp this message
        
    $TimeOfMessage date('d')."/".date('m')."/".date('y')."(".date('D').") @ ".date('H:i');

        
    // finally, send e-mail
        
    $ip=$_SERVER["REMOTE_ADDR"];
        
    $message "The following was sent on " .$TimeOfMessage."\n";
        
    $message .= "---------------------------------------------------------\n";

        
    // send the complete set of variables as well
        
    while (@list($var,$val) = @each($_POST)) {
          if (
    is_array($val)){
            
    $temp '';
            foreach(
    $val as $newval){
              
    $temp .= "$newval, ";
            }
            
    $message .= "$var: $temp\n";
          } else {
            
    $message .= "$var: $val\n";
          }
        }

        
    // send the email
        
    mail($your_email$subject$message"From: $name <$email>");

        
    // go to return URL
        
    if (isset($thankyou)) {
        
    header("Location: $thankyou");
        exit();
        }



    ?>

  • #4
    Regular Coder meth's Avatar
    Join Date
    Jan 2003
    Posts
    262
    Thanks
    0
    Thanked 9 Times in 9 Posts
    Ensure the html form has it's 'action' attribute set to the above file URL i.e.:

    action="mailScript.php"

    Consider changing the line:

    mail($your_email, $subject, $message, "From: $name <$email>");

    to

    mail($your_email, $subject, $message, "From: $email");

    Windows servers handle the header "From: $name <$email>" no problems; alternative servers choke on it sometimes.
    I do Web Design, Brisbane based.
    More time spent in PHP/MySQL Web Development.
    And Search Engine Optimisation takes up the rest of it.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •