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);
$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

A href problem under php
Hello...

I tried to explain the issue in an earlier post.. but was not clear enough....

Table control is disappearing from Screen
Hi Experts,

I have a screen with multiple table control(TC). Each table control has two c

* Gridview and Detailsview in UpdatePanel, insert mode problem
I have a GridView and DetailsView working together. When a record from Gridview is selected, Detail

Basic Question Regarding PHP Includes
Hi

Just starting out with PHP.

Working on a site that uses some basic includes, these

SMTP server...
I recently found a tutorial online on SMTP authentification for sending emails from webpages, here i

Simpler method of getting variables from mysql
Hi Guys,

I'm trying to streamline my CMS's code and as I was writing a new page it occured to

ereg_replace in Wordpress
Heya - so I'm working on this site: http://world-of-smiles.theportlandco.com/new-patients

The

Aris, Netweaver BPM, Visual composer and X'app
Dear Experts,

Whats the relationship between the following components: Aris, Netweaver BP

DELETE rows based on content
I have a link in my rows

$bit="http://bit.ly/abcd";
$query = mysql_query("D

SuperCali PHP Event Calendar
does anyone have any experience with the SuperCali PHP Event Calendar? I could use some assistance

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