我单击了提交,并将值添加到了db中,但是当重新加载页面值时,如果我又添加了一次, 再次单击,值将添加到db
<?php
if(isset($_POST['add_new'])){
if($_SERVER['REQUEST_METHOD'] == 'POST'){
$usName = $_POST['usName'];
$date = $_POST['date'];
$email = $_POST['email'];
$status = $_POST['status'];
$errors=array();
if(!empty($usName) and !empty($date) and !empty($email) ){
$stm1= $con->prepare("INSERT INTO members(username,date,email,status)
VALUES (:usN,:Date,:Mail,:status)");
$stm1->execute(array(
":usN"=>$usName ,
":Date"=>$date ,
":Mail"=>$email ,
":status"=>$status)
);
$success="the member has added";
} else {
$errors[]='all fildes are required';
}
} else {
echo 'bad';
}
}
?>