Drupal: Help creating a block with a custom form

I could not find a module that would let me create a form with custom fields and put it in a block, so I decided to do a little work…

I created a block with a form.
Form goes to a page created in drupal with php filter to send the contents of the form as an email, and then redirect the user to thank-you.php.

The php code is from mail script I have been using for a long time, works with any forms I create.

I am not sure what to really do, not very proficient in php at all.

You can view the form at , it is on the right.

Here is the code for the script. Thanks for help in advance

<?php

/* INSTRUCTIONS
 **************
 * 1) Change the 'emailTo' variable (below) from "you@yourdomain.com (Your Name)" to your own email and your own name
 * 2) Change the 'emailFrom' variable (below) from "yourdomain.com" to your own domain (no www required)
 * 3) a) Change the 'redirect' variable (below) from "www.yourdomain.com" to your own domain.  
 *    b) Make sure you have a "thank_you.htm" in the root folder of your website
 * 4) Make sure that each of your for elements on the page that submits to this script are named 
 *    ike the following: <input type=text name="INFO__User_Name">
 *    NOTE: You cannot have spaces in the name of the for element.
 *    ie: GOOD element name "INFO__User_Name"
 *        BAD element name "INFO__User Name"
 * 5) Set the "action" of the form to "process_form.php" in the form page that submits to this script
 *    Example: <form method='post' action='process_form.php'>
 * 6) Submit form to make sure all required information gets emailed to you.  If not, then go through steps 4 and 5 again.
 */

// CONFIGURATION SETTINGS 
$emailTo     = "info@consumerag.com";
$emailFrom   = "noreply@consumerag.com (ConsumerAG.com)";
$subject     = "Inquiry from ConsumerAG Website";
$redirectURL = "http://consumerag.com/content/11/thank-you.html";


// PLACE ALL FIELDS PASSED IN FROM FORM INTO MESSAGE BODY
foreach ($_POST as $key => $value) {
  $keyInfo = explode("__", $key);
  
  if ($keyInfo[0] == "INFO") {
    $message .= $keyInfo[1].":n ".$value."nn";
  }
}

// SEND EMAIL
mail($emailTo, $subject, $message, "From: ".$emailFrom);

// REDIRECT TO SPECIFIED THANK YOU PAGE
header("Location: $redirectURL");

?>

Nevermind. Found a module that works correctly. Webform lets me create custom forms. Webform block lets me put them in blocks.

Just what I wanted.