<?php
require 'app/config.php';

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $phone = $_POST['phone'];
    $massage = utf8_encode($_POST['massage']);
    $send_time = $_POST['gsend_time'];
    $pattern_code = $_POST['pattern_code'];

    
   

    $stmt = $db->prepare("INSERT INTO phone (phone, massage, send_time, patterncode, status) VALUES (?, ?, ?, ?, 'pending')");
    $result=$stmt->execute([$phone, $massage, $send_time, $pattern_code]);
    // Redirect to index.php
    echo json_encode($result);
}