Poley
11-12-2007, 04:38 PM
Hi there,
I get the following error message when using what i think should be the correct php script for my contact form.
Error 405 Method Not Allowed
The requested method POST is not allowed for URL /contact.php
How can I solve this?
My host server does support PHP.
Thanks!!
Contact form html is:
<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>
PHP code is:
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);
}
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ClientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ClientIP = $_SERVER['REMOTE_ADDR'];
}
$FTGT1 = DoStripSlashes( $_REQUEST['T1'] );
$FTGT2 = DoStripSlashes( $_REQUEST['T2'] );
$FTGS1 = DoStripSlashes( $_REQUEST['S1'] );
# Redirect user to the error page
if ($ValidationFailed === true) {
header("Location: http://www.itstravel.co.uk/ITS/contactfailed");
exit;
}
# Email to Form Owner
$emailSubject = FilterCChars("Enquiry from ITS Website");
$emailBody = "Name : $FTGT1\n"
. "Email : $FTGT2\n"
. "Phone : $FTGS1\n"
. "";
$emailTo = "ITS <enquiry@itstravel.co.uk>";
$emailFrom = FilterCChars("$FTGT2");
$emailHeader = "From: $emailFrom\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/ITS/thankyou");
exit;
?>
I get the following error message when using what i think should be the correct php script for my contact form.
Error 405 Method Not Allowed
The requested method POST is not allowed for URL /contact.php
How can I solve this?
My host server does support PHP.
Thanks!!
Contact form html is:
<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>
PHP code is:
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);
}
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ClientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ClientIP = $_SERVER['REMOTE_ADDR'];
}
$FTGT1 = DoStripSlashes( $_REQUEST['T1'] );
$FTGT2 = DoStripSlashes( $_REQUEST['T2'] );
$FTGS1 = DoStripSlashes( $_REQUEST['S1'] );
# Redirect user to the error page
if ($ValidationFailed === true) {
header("Location: http://www.itstravel.co.uk/ITS/contactfailed");
exit;
}
# Email to Form Owner
$emailSubject = FilterCChars("Enquiry from ITS Website");
$emailBody = "Name : $FTGT1\n"
. "Email : $FTGT2\n"
. "Phone : $FTGS1\n"
. "";
$emailTo = "ITS <enquiry@itstravel.co.uk>";
$emailFrom = FilterCChars("$FTGT2");
$emailHeader = "From: $emailFrom\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/ITS/thankyou");
exit;
?>