I'm looking for a code that allows me to submit email addresses and names to the database
i kinda wonder if this code can do it??
i kinda wonder if this code can do it??
PHP:
<?php
include("database.php");
$e = $_POST['email'];
$n = $_POST['name'];
if ($e == "" || $n == ""){
header("location: ../submit.php");
exit();
}
$q = mysql_query("SELECT id FROM email WHERE email = '$e' LIMIT 1")or die(mysql_error());
if ($n = mysql_num_rows($q)){
echo "already exists";
exit();
header("location: ../submit.php");
}
echo $n;
exit();
mysql_query("INSERT INTO email VALUES(null, '$e', '$n', 0)")or die(mysql_error());
header("location: ../Index.php?success=added");
?>





