Contact form sending even when unfilled
-
The contact form works, but emails are sent even when one or none of the requirements are filled. The error message shows up though. Here’s the default contact form code:
<?php if(isset($_POST['submitted'])) { if(isset($_POST['myname']) && isset($_POST['email'])) { if((trim($_POST['myname']) != "" ) && (trim($_POST['email']) != "" )) { ?> <p class="bg-success"><?php _e('Thanks for contacting us!', 'wp-simple' ); ?></p> <?php } else { ?> <p class="bg-danger"><?php _e('Please enter the required fields (marked with *).', 'wp-simple' ); ?></p> <?php } } } if(isset($_POST['submitted'])) { $venture_contact_recipient_email = nimbus_get_option('contact-mailto'); $venture_contact_sender_email = nimbus_get_option('contact-mailfrom'); if($venture_contact_recipient_email != '' && $venture_contact_sender_email != '') { extract($_POST); $blog_name = get_bloginfo('name'); $message = "Name: $myname Email: $email Company: $website Comments: $comments "; $headers = 'From: '.$blog_name.' <'.$venture_contact_sender_email.'>' . "\r\n"; wp_mail($venture_contact_recipient_email, 'Contact Form', $message, $headers); } } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Contact form sending even when unfilled’ is closed to new replies.