Page 1 of 1
how to stop multiple entries?
Posted: Sun Dec 05, 2004 10:57 am
by kanchan
i want the code to stop the users from posting the form not more than i time...........
i want them to block them from their emails...........
can anybody help me?
Posted: Sun Dec 05, 2004 11:07 am
by kettle_drum
Store all the emails that people use to submit the form and then check to make sure that the email entered has not already been entered - a simple if statment or in_array() will do it.
Posted: Sun Dec 05, 2004 11:14 am
by kanchan
kettle_drum wrote:Store all the emails that people use to submit the form and then check to make sure that the email entered has not already been entered - a simple if statment or in_array() will do it.
can u please let me the code..........
Posted: Sun Dec 05, 2004 3:32 pm
by John Cartwright
Code: Select all
<?php
session_start();
if (isset($_SESSION['posted']))
{
echo 'You have already posted';
}
else
{
//do your thing here
$_SESSION['posted'] = 'set';
}
?>
Depending on your setup, it will look something like this
Posted: Sun Dec 05, 2004 4:49 pm
by kettle_drum
Either as phemom says with sessions or:
Code: Select all
CREATE TABLE emails (
address varchar(255) NOT NULL unique,
PRIMARY KEY (address)
);
Code: Select all
$address_posted = $_POST['email_address'];
$result = mysql_query("SELECT * FROM emails WHERE address = '$address_posted'");
if(mysql_num_rows($result)){
echo "You have already submitted the form.";
}else{
echo "Thanks for submitting the form.";
mysql_query("INSERT INTO emails VALUES ('$address_posted')");
}