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

Operator precedence assistance.
I did a quick Google search and couldn't quite find the answer I wanted in terms I could understand,

mysq_num_rows
Hi,

I want to use:

Code: if(mysql_num_rows($ergebnis2)==2)
how can the value 2, be

Snapshot from video
anyone knw how to make a snapshot maker from avi n mkv format.
for example if i give a direct lin

Need PHP help... have all the elements... just need help putting them together :
Hey Guys,

I was wondering if someone could help me. I am doing a website for a client which

Stopping page post back
I have few literal contriols in my page and a repeater too. But inspite of using update panel, postb

Need help with simple code, back and forward buttons.
Basically, I have a set of pages in a folder, which have the title somephrasehere_09.php, somephrase

How to generate a random array of integers subject to a certain constraint
I am writing a program that asks the user to enter an integer N and then generates a random array of

file_put_contents and createimagefromjpeg
All,
I do somethings and then I have the following code:
file_put_contents('./test/'.$filename

Character Set Setup
Whats the best character set to use if you want every character to work, and also how do you make yo

Date/Time and Checkbox
Hi Everyone,

I am trying to figure out how to insert the current date and tim

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