" ; echo "Please go back and fill in these missing fields.

" ; //Display the error. echo $strError ; } function isValidForm($strTempEmail, $strTempSubject, $strTempFullname, $strTempComplaint) { //Set strError Variable to global so we can use the Variable //outside of the function. global $strError ; //Initiate the variable by setting it eqaul to nothing. $strError = "" ; if($strTempEmail == "") { //Build the string error message by Cocantenating the strError Variable //to itself. $strError .= "E-mail Address field.
" ; } if($strTempSubject == "") { //Build the string error message by Cocantenating the strError Variable //to itself. $strError .= "Subject field.
" ; } if($strTempFullname == "") { //Build the string error message by Cocantenating the strError Variable //to itself. $strError .= "Full Name field.
" ; } if($strTempComplaint == "") { //Build the string error message by Cocantenating the strError Variable //to itself. $strError .= "Your Complaint field.
" ; } //Test to see if the strError Variable contains a message //If it does then return false (not an valid form). //If strError Variable is empty or "" then return true (is a valid form). if($strError != "") { return false ; } else { return true ; } } function MailForm($strTempEmail, $strTempSubject, $strTempFullname, $strTempOperatingSystem, $strTempComplaint) { //Company Email address. $strCompanyEmail = "youremail@yourdomain.com" ; //Build the message body by cocantenating the strings. $strMailBody .= "You have received an e-mail on: " . date("r") . "\n" ; $strMailBody .= "from Customer Complaint Form.\n\n" ; $strMailBody .= "Name: " . $strTempFullname . "\n" ; $strMailBody .= "E-mail: " . $strTempEmail . "\n" ; $strMailBody .= "Operating System: " . $strTempOperatingSystem . "\n\n" ; $strMailBody .= "Complaint: " . $strTempComplaint . "\n" ; //Remove any escaped characters placed by php form. $strMailBody = stripslashes($strMailBody) ; $strCompanyHeaders = "From: Customer Complaint Form" ; //Build Customer Body of email. $strCustomerMailBody .= "Dear " . $strTempFullname . ",\n\n" ; $strCustomerMailBody .= "We received your complaint and \n" ; $strCustomerMailBody .= "will be contacting you within the next two business days.\n" ; $strCustomerMailBody .= "We are sorry for any inconcenience this may have caused.\n" ; $strCustomerMailBody .= "Sincerly,\n" ; $strCustomerMailBody .= "Customer Complaint Department\n\n" ; $strCustomerMailBody .= "Below is the information you submitted to us:\n\n" ; $strCustomerMailBody .= "Name: " . $strTempFullname . "\n" ; $strCustomerMailBody .= "E-mail: " . $strTempEmail . "\n" ; $strCustomerMailBody .= "Operating System: " . $strTempOperatingSystem . "\n\n" ; $strCustomerMailBody .= "Complaint: " . $strTempComplaint . "\n" ; //Remove any escaped characters placed by php form. $strCustomerMailBody = stripslashes($strCustomerMailBody) ; /* additional headers */ $strCustomerHeaders = "From: Customer Complaint Department" ; //Mail the form. /*Please Note: This is very important. If you are using a Windows Operating system you need to go into your php.ini file and change two settings for this mail function to work. Before doing this however, make sure you make a copy of the php.ini file. Mine was found under this section of the ini file... "[mail function]" You should see a section like this: [mail function] ; For Win32 only. SMTP = localhost ; For Win32 only. sendmail_from = me@localhost.com This is where you will make your changes. Change just below where it says: "; For Win32 only." From: "SMTP = localhost" to Your e-mail host settings for out going mail. As in "SMTP = smtp.comcast.net" Also change the section just below that from: "sendmail_from = me@localhost.com" to your email such as "sendmail_from = mrjones@hotmail.com" Then Save your changes. */ //Mail to company. mail($strCompanyEmail, $strTempSubject, $strMailBody, $strCompanyHeaders) ; //Mail to Customer. mail($strTempEmail, $strTempSubject, $strCustomerMailBody, $strCompanyHeaders) ; } function WriteMessage($strTempEmail, $strTempSubject, $strTempFullname, $strTempOperatingSystem, $strTempComplaint) { echo "
" ; echo "
" ; echo "Dear " . $strTempFullname . ",

" ; echo "We regret any problems this may have caused you.
" ; echo "Please be assured that we value you as a customer and know
" ; echo "your time is valuable.
" ; echo "Here is the information you submitted to us:

" ; echo "Name: " . $strTempFullname . "
"; echo "E-mail: " . $strTempEmail . "
"; echo "E-mail Subject: " . $strTempSubject . "
"; echo "Operating System: " . $strTempOperatingSystem . "
"; echo "Complaint: " . $strTempComplaint . "
"; echo "
" ; echo "
" ; } ?>