poleman Posted November 21, 2007 Share Posted November 21, 2007 Hi, I have no idea why this contact form is not working when it is copied directly from one that is but has just had the email address changed on it for where to send the notifications to.. hope you can help. Here is the Contact Form html: <p align="left"><FORM ACTION="contact.php" METHOD="post"> <div align="left"> <table border="0" cellspacing="1" style="border-collapse: collapse" > <tbody class="body_main"> <tr> <td> <b><font face="Tahoma" size="2" color="#FF6600">Name:</font></b></td> <td class="body_small"> <input type="text" name="name" size="20" /> </td> </tr> <tr> <td> <b><font face="Tahoma" size="2" color="#FF6600">Contact Tel:</font></b></td> <td class="body_small"> <input type="text" name="tel" size="20" /> </td> </tr> <tr> <td> <b><font face="Tahoma" size="2" color="#FF6600">Email:</font></b></td> <td class="body_small"> <input type="text" name="email" size="30" /> <br> </td> </tr> <tr> <td valign="top"><b> <font face="Tahoma" size="2" color="#FF6600">Message:</font></b></td> <td class="body_small"> <textarea cols="44" rows="5" input type="text" name="message" /></textarea><br> <br> </td> </tr> </td> </tr> </tbody> </table> </div> <p><div align = "center"> <font face="Verdana"><input value="Submit" type="submit"></div> <p></p> </font> </form> And here is the PHP code: <?PHP ###################################################### # # # Forms To Go 3.1.1 # # http://www.bebosoft.com/ # # # ###################################################### ###################################################### # # # UNREGISTERED VERSION # # # ###################################################### DEFINE('kOptional', True); DEFINE('kMandatory', False); error_reporting(E_ERROR | E_WARNING | E_PARSE); ini_set('track_errors', true); function DoStripSlashes($FieldValue) { if ( get_magic_quotes_gpc() ) { if (is_array($FieldValue) ) { return array_map('DoStripSlashes', $FieldValue); } else { return stripslashes($FieldValue); } } else { return $FieldValue; } } #---------- # FilterCChars: function FilterCChars($TheString) { return preg_replace('/[\x00-\x1F]/', '', $TheString); } #---------- # Validate: Email function check_email($email, $optional) { if ( (strlen($email) == 0) && ($optional === true) ) { return true; } elseif ( eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email) ) { return true; } else { return false; } } if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ClientIP = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ClientIP = $_SERVER['REMOTE_ADDR']; } $FTGname = DoStripSlashes( $_REQUEST['name'] ); $FTGtel = DoStripSlashes( $_REQUEST['tel'] ); $FTGemail = DoStripSlashes( $_REQUEST['email'] ); $FTGmessage = DoStripSlashes( $_REQUEST['message'] ); # Fields Validations $ValidationFailed = false; if (!check_email($FTGemail, kMandatory)) { $ValidationFailed = true; } # Include message in error page and dump it to the browser if ($ValidationFailed === true) { $ErrorPage = '<html><head><title>Error</title></head><body>'; $ErrorPage .= 'Errors found: <!--VALIDATIONERROR-->'; $ErrorPage .= '</body></html>'; $ErrorPage = str_replace('<!--VALIDATIONERROR-->', $ErrorList, $ErrorPage); $ErrorPage = str_replace('<!--FIELDVALUE:name-->', $FTGname, $ErrorPage); $ErrorPage = str_replace('<!--FIELDVALUE:tel-->', $FTGtel, $ErrorPage); $ErrorPage = str_replace('<!--FIELDVALUE:email-->', $FTGemail, $ErrorPage); $ErrorPage = str_replace('<!--FIELDVALUE:message-->', $FTGmessage, $ErrorPage); echo $ErrorPage; exit; } # Email to Form Owner $emailSubject = FilterCChars("Enquiry from ITS Website"); $emailBody = "FAO: ITS" . "\n" . "\n" . "Name : $FTGname\n" . "Tel : $FTGtel\n" . "Email : $FTGemail\n" . "Message : $FTGmessage\n" . "\n" . "Thanks\n" . "\n" . "$FTGname\n" . ""; $emailTo = "<all@itstravel.co.uk>"; $emailFrom = FilterCChars("$FTGname"); $emailHeader = "From: $emailFrom\n" . "Cc: <rclayton20@hotmail.com>" . "\n" . "MIME-Version: 1.0\n" . "Content-type: text/plain; charset=\"ISO-8859-1\"\n" . "Content-transfer-encoding: 8bit\n"; mail($emailTo, $emailSubject, $emailBody, $emailHeader); # Redirect user to success page header("Location: http://www.itstravel.co.uk/docroot/thankyou.htm"); exit; ?> Here is the error message: Error 405 Method Not Allowed The requested method POST is not allowed for URL /contact.php Powered by Zeus Technology Quote Link to comment Share on other sites More sharing options...
poleman Posted November 21, 2007 Author Share Posted November 21, 2007 can anyone help with this? ??? Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 21, 2007 Share Posted November 21, 2007 http://en.wikipedia.org/wiki/404_error Quote Link to comment Share on other sites More sharing options...
DyslexicDog Posted November 21, 2007 Share Posted November 21, 2007 Did you change servers? because it looks like the server you are on is blocking POST variables. Quote Link to comment Share on other sites More sharing options...
DyslexicDog Posted November 21, 2007 Share Posted November 21, 2007 http://en.wikipedia.org/wiki/404_error it's a 405 error Quote Link to comment Share on other sites More sharing options...
premiso Posted November 21, 2007 Share Posted November 21, 2007 http://en.wikipedia.org/wiki/405_error 405 Method Not Allowed A request was made to a URL using a request method not supported by that URL; for example, using GET on a form which requires data to be presented via POST, or using PUT on a read-only resource Quote Link to comment Share on other sites More sharing options...
poleman Posted November 21, 2007 Author Share Posted November 21, 2007 yes I did change servers. I copied it from a form which was on a server that does accept POST methods. It seems this new server does not like it. I did try directing the html form to the php code and have that php code hosted on the server that does allow php script. The success redirect page then shoots the success page back to the other server. It worked but is not an ideal solution. Any ideas how I can get everything staying on the same server and get around the blocking problem? Thanks Quote Link to comment Share on other sites More sharing options...
poleman Posted November 21, 2007 Author Share Posted November 21, 2007 any ideas how i can get around my host server blocking a very common contact form php code? Quote Link to comment Share on other sites More sharing options...
revraz Posted November 22, 2007 Share Posted November 22, 2007 Ask them why it isn't enabled? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.