Jump to content

Little Help


TomH

Recommended Posts

Hi all,

 

I have this script, nothing enteres the database. No errors either :S

 

<?php

include('connect.php');

 

$email = strip_tags(trim(stripslashes($_POST['email'])));

$submit = $_POST['submit'];

 

$query = "INSERT INTO newsletter (email) VALUES ('$email');";

 

if(isset($submit)){

 

function checkmail($email) {

 

if(preg_match('/\A(?:[a-zA-Z0-9]!#$%&\'*+\/=?^_`{|}~-])+(?:\.[a-zA-Z0-9]!#$%&\'*+\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-z0-9])?\.)+(?:[a-zA-Z]{2}|com|org|net\b)\Z/i',$email)) return true;

 

}

 

if(checkmail($email)) { mysql_query($query); }else{ mysql_close(); }

}

?>

Link to comment
https://forums.phpfreaks.com/topic/61092-little-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.