...

View Full Version : I have a simple form. What am I missing?



mike2211
12-23-2006, 12:56 PM
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!

Tyree
12-23-2006, 02:49 PM
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.

mike2211
12-23-2006, 11:46 PM
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
// 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();
}



?>

meth
12-24-2006, 01:23 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum