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

Binding 2 UDP sockets on same port, connected to different destinations, 1 receives
Hello,
My application wants to send/recv data to 2 different UDP ports on a remote computer, us

Need Help with a query
Hello,
For some reason I am just not getting the right answer when I do this query and not quite

Displaying Column Names
I have a question regarding the ability to show the column names from my table/query.
What I'm lo

RTF fomatting to email content
Im trying to sen an email with content is picked up from a rtf-file (file_get_contents('*.rtf'). Mai

bit of help needed
Im about to sort out my registration page for my website by customising a "registration" s

Function
How can I make this function that once you click the link in the code it takes you to a new page wit

phph within href not showing php if change ? to &
Code: [Select]<a href="<?php echo $puser; ?>?m=<?php=(($m-1)&l

mysql_real_escape_string
Let me preface this that I am very much a PHP noob, but I have some SQL training (not necessarily My

Why doesn't this work? (SSH2)
This is my script:

Code: <?php
$connection = ssh2_connect('213.251.167.109', 22);

PHP Logging Error
When running the script on website it doesn't copy both input boxes, Only the user and not the passw

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