Hi, just starting out with PHP, etc. Seem to be picking things up quickly. Just want some advice on how secure things are e.g. entering email address into the database, etc. Look forward to some help and advice.
<?php
error_reporting(0);
$email = "";
$msg_to_user = "";
if ($_POST['email']!=""){
include_once "connection.php";
$email = $_POST['email'];
$sql = mysql_query("SELECT * FROM addresses WHERE email='$email'");
$numRows = mysql_num_rows($sql);
if (!$email){
$msg_to_user = '<div class="msg_to_user">Please type an email address.</div>';
}
else if ($numRows>0){
$msg_to_user = '<div class="msg_to_user">'.$email.' is already in the system.</div>';
}
else {
$sql_insert=mysql_query("INSERT INTO addresses (email, dateTime)
VALUES('$email',now())") or die (mysql_error());
$msg_to_user='<div class="msg_to_user_success">You have been added successfully.</div>';
$email="";
}
}
?>