HI , First at all i'm a newbie and sorry if this a dumb question.

i want to create a form that only can be submitted once per day by each user, each user has thier own id. My question is how to create a process that will check if the user already submitted and only can be summited on the next day .

This is code that i have tried and now working

<?php

include("../../config/config.php");

        $id=$_POST['id_student'];
        $id_kedai=$_POST['id_kedai'];
        $now_date_time=date('Y/m/d');


        $quer1="SELECT * FROM activity_log where id_user='$id' AND date_create_log = '$now_date_time'";
         $quer2=mysqli_query($db_conn_e,$quer1);
           while ($row= mysqli_fetch_array($quer2)>0){
        if($row["date_create_log"] ==  $now_date_time=date('Y/m/d')){
    echo "<script langauge=\"javascript\">alert(\"Data Already Inserted Today\");
            </script>";
}

       else
       {  


        $que1="INSERT INTO activity_log (id_user,id_kedai)  VALUES ('$id','$id_kedai')";
        $que2= mysqli_query($db_conn_e,$que1); 


      if($que2){
        echo    "<script langauge=\"javascript\">alert(\"Success\");
                window.location='../submited.php?id=$id'
            </script>";

      }
}

           }      
?>

the date_create_log is set as current_timestamp in database.

Sorry for asking.

You may use session or user ID and check if it is same, then you can disable the submit!

commented: thanks for giving me idea +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.