heres the whole file im trying to get to work:
PHP Code:
<?php
/**
* Template Name: Contact
*
*Contact Page Template
*
* The "Template Name:" bit above allows this to be selectable
* from a dropdown menu on the edit page screen.
*
* @package WordPress
* @subpackage The Aggressive Network
* @since The Aggressive Network V1.0
*/
?>
<?php
if(isset($_POST['Submit_x'])) {
$Your_Name = htmlspecialchars($_POST['Name']);
$email = htmlspecialchars($_POST['Email']);
$email2 = htmlspecialchars($_POST['Email2']);
$message = htmlspecialchars($_POST['Message']);
$security1 = $_POST['security_code'];
$security2 = $_SESSION['security_code'];
$subject = htmlspecialchars($_POST['Subject']);
$website = htmlspecialchars($_POST['WebsiteURL']);
if($Your_Name == '') {
$err = true;
$msg = '! Please enter your name';}
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$",$email) or $email == '') {
$err4 = true;
$msg4 = '! Please enter a valid email address';}
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$",$email2) or $email2 == '') {
$err8 = true;
$msg8 = '! Please enter a valid email address';}
list($userName, $mailDomain) = split("@", $email);
if ($email2 !== $email) {
$err8 = true;
$msg8 = '! Email Addresses do not match';}
if($subject == 1) {
$err6 = true;
$msg6 = '! Please select subject';}
if($message == '') {
$err5 = true;
$msg5 = '! Please type a message';}
if($security1 == '') {
$err3 = true;
$msg3 = '! Please enter security code before trying to submit the form.';}
if($security2 != $security1) {
$err2 = true;
$msg2 = '! Sorry, you have provided an invalid security code. Please try again.';
} else {
if (eregi("\r",$email, $email2) || eregi("\n",$email, $email2)){
die ("spam!");
} else {
if(($err == false) && ($err4 == false) && ($err8 == false) && ($err6 == false) && ($err5 == false) && ($err3 == false) && ($err2 == false) && ($err9 == false) && ($err10 == false)) {
$showForm = false;
$mailmsg = 'The following email has been sent from the Dragon Ink contact form:' . "\n\n";
$mailmsg.= 'Name: ' . $Your_Name . "\n";
$mailmsg.= 'Email: ' . $email . "\n";
$mailmsg.= 'Website: ' . $website . "\n";
$mailmsg.= 'Subject: ' . $subject . "\n";
$mailmsg.= 'Message: ' . $message . "\n";
mail('support@theaggressive.com',$subject, $mailmsg, "From: Dragon-Ink");
unset($_SESSION['security_code']);
$emailSent = true;
$thy = true;
$thymsg = '<img src="contact/images/thankyou.jpg" width="188" height="33" alt="Thank You" border="0"><br />
<p class="thy">Your message was sent: <span class="date">' . date("l, F j, Y @ g:ia") . '</span></p>';
}
?>
<?php
get_header(); ?>
<div id="main">
<div id="left">
<div class="left_Content"><div class="white_border">
<h2>Contact Us</h2>
<p>Want to get a hold of us? Feel free to offer any suggestions or if you have a question or a concern. Just simply fill out the form below. We will try our best to respond back to you as soon as we can.</p>
<?php if($emailSent == true) { ?>
<div class="thanks">
<h1>Thanks!</h1>
<p>Your email was successfully sent. I will be in touch soon.</p>
</div>
<?php } else { ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
<p class="news_dates">* Required Fields </p>
<form action="<?php the_permalink(); ?>" method="POST" class="form">
<div class="labelContainer"><label for="First_name"><span class="news_dates">*</span> Name:</label></div>
<div class="fieldContainer"><input type="text" name="Name" id="Name" value="<?php echo $Your_Name; ?>" />
<?php
if($err == true) {
echo '<p class="error">'. $msg . '</p>';
}
?>
</div>
<div class="labelContainer"><label for="email"><span class="news_dates">*</span> Email:</label></div>
<div class="fieldContainer"><input type="text" name="Email" id="Email" value="<?php echo $email; ?>" />
<?php
if($err4 == true) {
echo '<p class="error">'. $msg4 . '</p>';
}
if($err7 == true) {
echo '<p class="error">'. $msg7 . '</p>';
}
?>
</div>
<div class="labelContainer"><label for="email2"><span class="news_dates">*</span> Verify Email:</label>
</div>
<div class="fieldContainer"><input type="text" name="Email2" id="Email2" value="<?php echo $email2; ?>" />
<?php
if($err8 == true) {
echo '<p class="error">'. $msg8 . '</p>';
}
?>
</div>
<div class="labelContainer"><label for="name">Your Site:</label></div>
<div class="fieldContainer"><input name="WebsiteURL" type="text" id="WebsiteURL" value="http://www." /></div>
<div class="labelContainer"><label for="subject"><span class="news_dates">*</span> Subject:</label></div>
<div class="fieldContainer"><select name="Subject" size="1" id="Subject" class="Default_selectDropDown">
<option value="1">------------Please Select------------</option>
<option class="Selected_selectDropDown">Website Related</option>
<option class="Selected_selectDropDown">Advertisement</option>
<option class="Selected_selectDropDown">Articles Question or Comment</option>
<option class="Selected_selectDropDown">Products</option>
<option class="Selected_selectDropDown">Privacy Policy Question</option>
<option class="Selected_selectDropDown">Other</option>
</select>
<?php
if($err6 == true) {
echo '<p class="error">'. $msg6 . '</p>';
}
?>
</div>
<div class="labelContainer"><label for="message"><span class="news_dates">*</span> Message:</label></div>
<div class="fieldContainer"><textarea rows="8" cols="60" name="Message" id="Message" ><?php echo $message; ?></textarea>
<?php
if($err5 == true) {
echo '<p class="error">'. $msg5 . '</p>';
}
?>
</div>
<div class="mailing_check"><input name="mailing" type="checkbox" id="mailing" value="true"> Add me to your mailing list!</div>
<div class="codelabelContainer"><label for="code"><span class="news_dates">*</span> Code:</label></div>
<div class="captcha"><img src="<?php bloginfo('template_directory'); ?>/contact/CaptchaSecurityImages.php?width=120&height=40&characters=5" alt="Image Code" style="border: 1px solid #666; "/></div>
<div class="labelContainer"><label for="security_code"><span class="news_dates">*</span> Enter Code:</label></div>
<div class="fieldContainer"><input name="security_code" type="text" id="security_code" value="Enter above code here" onFocus="if(this.value=='Enter above code here')this.value='';" />
<?php
if($err2 == true) {
echo '<p class="error">'. $msg2 . '</p>';
}
if($err3 == true) {
echo '<p class="error">'. $msg3 . '</p>';
}
?>
</div>
<div class="submit"><input name="Submit" type="submit" value="Submit" alt="Submit" /></div>
</form>
<?php endwhile; ?>
<?php endif; ?>
<?php } }
}
}
?>
</div><!-- white_border --></div><!-- left_Content -->
</div><!-- left -->
<?php include(TEMPLATEPATH . '/sidebar1.php'); ?>
</div><!-- main -->
</div><!-- close wrap -->
</div><!-- bg_top_grad -->
<?php get_footer(); ?>
ALSO i dont know why my captcha images isnt showing. i placed it in my themes folder named contact. it was working before trying to use it on this wordpress blog.
Bookmarks