For some reason I cannot seem to get my form to submit or use the "send_contact.php" page. I can't figure out what im doing wrong. Here is the form on my contacts.php page. Should I change it back to contacts.html like it was before? I don't know if I had to have as a .php for it to access my send_contact.php file
<h2>Contact Form</h2>
</header>
<div class="content">
<form action="send_contact.php" method="post" enctype="text/plain" id="contacts-form">
<fieldset>
<div class="grid_7 alpha">
<label><input type="text" name="name" id="name" value="Name:" onfocus="if(this.value=='Name:') this.value='';" onblur="if(this.value=='') this.value='Name:';"/></label>
<label><input type="text" name="email_address" id="email_address" value="E-mail:" onfocus="if(this.value=='E-mail:') this.value='';" onblur="if(this.value=='') this.value='E-mail:';"/></label>
<label><input type="text" name="phone" id="phone" value="Phone:" onfocus="if(this.value=='Phone:') this.value='';" onblur="if(this.value=='') this.value='Phone:';"/></label>
<label><input type="text" name="address" id="address" value="Address:" onfocus="if(this.value=='Address:') this.value='';" onblur="if(this.value=='') this.value='Address:';"/></label>
</div>
<div class="grid_8 omega">
<textarea onfocus="if(this.value=='Message:') this.value='';" name="comments" id="comments"onblur="if(this.value=='') this.value='Message:';">Message:</textarea>
<div class="wrapper">
<a href="" class="button" onclick="document.getElementById('contacts-form').submit()" value="Submit">Submit</a>
<a href="" class="button" onclick="document.getElementById('contacts-form').reset()">clear</a>
</div>
</div>
</fieldset>
</form>
Here is my send_contact.php file
<?php
$YourEmailAddress ='example@example.com' ; //Email address you want the mail to go to
$Yourname = 'John Smith'; //Who the email is sent from - this is a name not an email
$MailUsername = 'example2@example.com'; //Email address you are using to send the email
$MailPassword = 'password'; //This is the password of the emali account used to send the emali
$MailServer = 'webmail@example.com'; //Assigned mail server
$MailType = "html"; // Can use HTML or TEXT -case doesnt matter
require("class.phpmail.php"); //Change this to the real path of the file - this assumes that the mail script
//and the included filed are in the same directory
// contact subject
$subject="subject";
// details
$message="detail";
// mail of sender
$mailfrom="email_address";
// from
$header="from: $name <$mailfrom>";
// enter your email address
$to="example@example.com";
$sendcontact=mail($email_address, $comments, $name, $phone, $address);
// check, if message sent to your email
// display message "Thank you, we have recieved your information and will get back to you shortly."
if($send_contact){
echo"Thank you, we have recieved your information and will get back to you shortly.";
}
/*
This bit sets the URLs of the supporting pages.
If you change the names of any of the pages, you will need to change the values here.
*/
$feedback_page ="contact.php";
$error_page ="error_message.html";
$thankyou_page ="thank_you.html";
/*
This next bit loads the form field data into variables.
If you add a form field, you will need to add it here.
*/
$email_address = $_REQUEST['email_address'] ;
$comments = $_REQUEST['comments'] ;
$name = $_REQUEST['name'] ;
$phone = $_REQUEST['phone'] ;
$address = $_REQUEST['address'] ;
/*
The following function checks for email injection.
Specifically, it checks for carriage returns - typically used by spammers to inject a CC list.
*/
function isInjected($str) {
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str)) {
return true;
}
else {
return false;
}
}
// If the user tries to access this script directly, redirect them to the feedback form,
if (!isset($_REQUEST['email_address'])) {
header( "Location: $feedback_page" );
}
// If the form fields are empty, redirect to the error page.
elseif (empty($email_address) || empty($comments)) {
header( "Location: $error_page" );
}
// If email injection is detected, redirect to the error page.
elseif ( isInjected($email_address) ) {
header( "Location: $error_page" );
}
// If we passed all previous tests, send the email then redirect to the thank you page.
else {
mail( "$webmaster_email", "Feedback Form Results",
$comments, "From: $email_address" );
header( "Location: $thankyou_page" );
}
?>
And I edited this to my php.ini file on my host, enomcentral.com
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
include_path = ".;c:\php5","\class.phpmailer.php"
I have no clue what im doint wrong....Thank you So much for your time.
Silvius