email form (cannot find the problem)


Posted on 16th Feb 2014 07:03 pm by admin

Hello there. I've been having trouble with an email form. Can't find the problem really. I've tested so many times, tried different ifs to see where the problem comes from. It turned out its alway the last ELSE. The one that doesnt have explanation to me. Here we go: Code: if(isset($_GET['send'])) {

$email=filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
//$email = htmlentities($email,ENT_QUOTES);
Did you know?Explore Trending and Topic pages for more stories like this.
$body=stripslashes($_POST['body']);
$date = date("F j, Y, g:i a");
$valid = preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*@([a-z0-9])*(.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*$/i','09_az..AZ@host.dOMain.cOM');
$spam=preg_match('/(r|n)(to:|from:|cc:|bcc:)/',$body);
$ip = substr($_SERVER['REMOTE_ADDR'], 0, strrpos($_SERVER['REMOTE_ADDR'], "."));

if ($email && $body && $valid && !$spam) {
if ( mail( $to, "Feedback Form Results", $body, "From: $email" )) {

echo '<p>'.$thanks.'</p>';
$email='';
$body='';
}
else {
echo '<p>'.$error.'</p>';
$email='';
$body='';
}
}
else if ($spam) {
echo '<p>'.$spamattack.'</p>';
$email='';
$body='';
}
else {
echo'<p><strong>'.$fillin.'</strong></p>';
$email='';
$body='';
}

}
No comments posted yet

Your Answer:

Login to answer
298 Like 46 Dislike
Previous forums Next forums
Other forums

textfield unchanged
hi,
i want my form to know whether its textbox is unchange or not.

if($textbox == 'unchang

Access website from only 1 computer...?
One of my customers wants his website to only be accessed by people in which they bought the website

XML Grouping
I'm using xml_parse_into_struct to get all my elements, but now I need to group them. For example, h

Scheduler problems related to execution of a single BLT by many schedules
Hello all,

We are running several MII instances in a distibuted architecture using a sing

Strange Oracle Query problem
Ok So I have this PHP class that talks to a Javascript class that basically creates a table of infor

How can I uploading Transactional Data from Legacy to New SAP system
Hell Gurus,

I am overwhelmed with questions on how to migrate huge volume of Sales Orders

DATEDIFF Question
First time post, and of course it is a help question.

I am using a WP plug-in to display prev

List/Menu Box
On an edit page when you want something to select what a user has previously selected from the datab

Simple email form - Newbie
Hello all,

First time poster!

I've been asked to create a simple HTML form that submit

quick question about System Change Number(SCN) in FlashBack Query topic
i know tht we can get the SCN of the database using flashback concept as follows

SQL>

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash