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?
how to stop multiple entries?
Moderator: General Moderators
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
<?php
session_start();
if (isset($_SESSION['posted']))
{
echo 'You have already posted';
}
else
{
//do your thing here
$_SESSION['posted'] = 'set';
}
?>-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
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')");
}