<?php session_start();

    require_once '/../../db.connect.php';
    require_once '/../../helpers/func/helper.php';

    $topic = $_POST['topic'];
    $question = $_POST['questions'];
    $date = date("Y-m-d h:i:sa");

    if(isset($_POST['topic'])){
        $sql = "INSERT INTO questions (topic, question, date, user_id) VALUES ('".$topic."', '".$question."', '".$date."', ".$_SESSION['id'].")";
        if($conn->query($sql)){
            print 'successful';
        }else{
            print 'unsuccessful';
            // print "Error: " . $sql . "<br>" . $conn->error;
        }
    }
?>