here's my HTML form
- "utf-8">
- "viewport" content="width=device-width, initial-scale=1">
- "stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
- "stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/css/bootstrap-datetimepicker.min.css">
- "stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/css/bootstrap-datetimepicker-standalone.css">
- method="POST">
- class="col-md-6">class="form-group">
- ="name">Event Title:
- "text" class="form-control" id="first_name" placeholder="Should be 10 character" required="" name="title" maxlength="10" >
class="form-group">- ="name">Client Name:
- "text" class="form-control" id="first_name" placeholder="Enter Name" name="name" >
class="form-group">- ="text">Task:
- "text" class="form-control" name="task" placeholder="Enter Task">
- class="col-md-6">class="form-group">
- ="text">Set Date & Time:
class="form-group">class='input-group date' id='datetimepicker1' name="datepicker" value="date">- 'text' class="form-control" id="datepicker1" name="datepicker" value="date"/>
- class="input-group-addon">
- class="glyphicon glyphicon-calendar">
class="form-group">- ="text">Department:
- "text" class="form-control" name="department" placeholder="Select department " >
class="form-group">- ="text">Assign to:
- "text" class="form-control" name="assign" placeholder="Select" >
- name="submitform" class="btn btn-default" style="float:right;width:auto; padding:10px; font-size:16px; background-color:rgba(0,0,0,0.8); color:white;">Submit
AND Here's PHP- $servername = "localhost";
- $username = "root";
- $password = "";
- $db = "admin";
- // Create connection
- $conn = new mysqli($servername,$username,$password,$db);
- if(isset($_POST['submitform'])){
- $title = $_POST['title'];
- $name = $_POST['name'];
- $department = $_POST['department'];
- $task = $_POST['task'];
- $date =$_POST['datepicker'];
- $assign = $_POST['assign'];
- $now =date('m/d/Y h:i:s a', time());
- $query = "CREATE EVENT IF NOT EXISTS $title
- ON SCHEDULE AT '$date'
- DO
- INSERT INTO task(name,department,task,assign,deadline,created_at) VALUES ('$name','$department','$task','$assign','$date','$now')
- ;";
- mysqli_query($conn,$query);
- echo "
;
Event has been created.
You're notified that this will be fired automatically on your set date !
Redirecting back in 5 seconds ..." - header("Refresh: 1; url=test2.php");
- mysqli_close($conn);
- };
- ?>
Please guide, Please
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Joseph ThomasPosted Dec 10, 2018, 5:57 AM