	<?php 
include '../../connection.php';

// Check if the form is submitted
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $Title = $_POST['Title'];
    $Msg = $_POST['Msg'];
    $Date = $_POST['Date'];
    


    // Insert the new offer data into the database
    $insertSql = "INSERT INTO notify_user (title, message, date) 
										VALUES (?, ?, ?)";
    
    $stmt = $con->prepare($insertSql);
    $stmt->bind_param("sss", $Title, $Msg,$Date);

    if ($stmt->execute()) {
        $success_message = "New Notification Added Successfully.";
    } else {
        $error_message = "Error: " . $stmt->error;
    }

    $stmt->close();
}
?>
	
	<?php include 'header-link.php' ?>
	
	<?php include 'nav-bar.php' ?>

	
	<?php include 'header-top-chat.php' ?>
	
	
	<!-- [ Main Content ] start -->
<div class="pcoded-main-container">
    <div class="pcoded-wrapper">
        <div class="pcoded-content">
            <div class="pcoded-inner-content">
                <div class="main-body">
                    <div class="page-wrapper">
                        <!-- [ breadcrumb ] start -->
                        <div class="page-header text-center">
                            <div class="page-block">
                                <div class="row align-items-center">
                                    <div class="col-md-12">
                                        <div class="page-header-title">
                                            <h5 class="m-b-10"> Notification Add </h5>
                                        </div>
                                      
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- [ Main Content ] start -->
                        <div class="row justify-content-center">
                            <!-- [ form-element ] start -->
                            <div class="col-lg-6">
                                <div class="card">
                                    <div class="card-header">
                                        <h5> Add New Notification Info </h5>
                                    </div>
                                    <div class="card-body">
									 <?php if (!empty($success_message)): ?>
                                            <div class="alert alert-success"><?php echo $success_message; ?></div>
                                        <?php endif; ?>
                                        <?php if (!empty($error_message)): ?>
                                            <div class="alert alert-danger"><?php echo $error_message; ?></div>
                                        <?php endif; ?>
									
                                        <form action="" method="POST">
                                            <div class="form-group">
                                                <label class="form-label"> Title </label>
                                                <input type="text" name="Title" class="form-control" placeholder="Enter Title">
                                                
                                            </div>
																						
											
											
											
											<div class="form-group">
                                                <label class="form-label"> Message </label>
                                                <textarea type="text" name="Msg" class="form-control" row="5" value="Write here..." ></textarea>
                                                
                                            </div>
											
											<div class="form-group">
                                                <label class="form-label"> Date </label>
                                                <input type="date" name="Date" class="form-control" >
                                                
                                            </div>
											
											
											
											<div class="card-footer">
												<button type="submit" class="btn btn-primary me-2">Submit</button>
												<a href="notify.php" class="btn btn-light"> View </a>
											</div>
											
                                        </form>
                                    </div>
                                    
                                </div>
                               
                               
                            </div>

                           
                        </div>
                        <!-- [ Main Content ] end -->
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- [ Main Content ] end -->
	
	
	<?php include 'footer.php' ?>

