Jump to content

Problem with php feedback form


donnacha

Recommended Posts

Hi there,

Im a newbie to php and have run into difficulty. when i press submit i get this error.

 

HTTP Error 405 - The HTTP verb used to access this page is not allowed.

Internet Information Services (IIS)

 

I will admit that im not really sure what im doing and i hope someone can help. Here is my code:

 

<form action="send_mail.php" method="post">

<table>

<tr>

<td><font face="Verdana, Arial" color="#888D8F"><font size="-1"><b>Email Adress:</td>

<td><input type="text" name="email_address" value="" maxlength="100" />

</td></tr>

<tr>

<td><font face="Verdana, Arial" color="#888D8F"><font size="-1"><b>Comments:</td>

<td><textarea rows="10" cols="50" name="comments"></textarea>

</td>

</tr>

<tr>

<td> </td>

<td><input type="submit" value="Submit" />

</td>

</tr>

</table>

</form>

 

....and here is the send_mail.php code

 

<?php

  $email = $_REQUEST['email_address'] ;

  $message = $_REQUEST['comments'] ;

 

  if (!isset($_REQUEST['email_address'])) {

    header( "Location: http://www.pdpcrafts.com/Contact Us.html" );

  }

  elseif (empty($email) || empty($message)) {

    header( "Location: http://www.pdpcrafts.com/error_message.html" );

  }

  else {

    mail( "[email protected]", "Feedback Form Results",

      $message, "From: $email" );

    header( "Location: http://www.pdpcrafts.com/thank_you.html" );

  }

?>

Link to comment
https://forums.phpfreaks.com/topic/178469-problem-with-php-feedback-form/
Share on other sites

Hi donnacha,

 

Replace your $_REQUEST with $_POST, for example:

 

<?php
  $email = $_POST['email_address'] ;
  $message = $_POST['comments'] ;

  if (!isset($_POST['email_address'])) {
    header( "Location: http://www.pdpcrafts.com/Contact Us.html" );
  }
  elseif (empty($email) || empty($message)) {
    header( "Location: http://www.pdpcrafts.com/error_message.html" );
  }
  else {
    mail( "[email protected]", "Feedback Form Results",
      $message, "From: $email" );
    header( "Location: http://www.pdpcrafts.com/thank_you.html" );
  }
?>

 

Hope this helps.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.