I'm new in PHP. When I try to use the js prompt and input the listname, that will no system error, but $result->execute() is always return false value.
I checked mySql is never stored the data, so I don't know what I miss.
<?php
    session_start();
    $_Code_ = $_GET['_Code_'];
    $Name = $_GET['Name'];
    $Open = $_GET['Open'];
    $Close = $_GET['Close'];
    $UpDown = $_GET['UpDown'];
    $mName = $_SESSION['mName'];
    function prompt($prompt_msg){
        echo("<script type='text/javascript'> var answer = prompt('".$prompt_msg."'); </script>");
        $answer = "<script type='text/javascript'> document.write(answer); </script>";
        return($answer);
    }
    $prompt_msg = "Input the listname:";
    $listname = prompt($prompt_msg);
    $_SESSION['ListName'] = $listname;
    include_once 'connect.php';
  
    $result = $mysqli->prepare("INSERT INTO list(mName, _Code_, ListName) VALUES (?, ?, ?)");
    $result->bind_param('sss', $mName, $_Code_, $test); 
    if($result->execute()){
        echo "<SCRIPT LANGUAGE='javascript'> 
                window.alert ('Success')
                window.location ='add.php'   
                </SCRIPT>";
    }
    else{
        echo "<SCRIPT LANGUAGE='javascript'> 
                window.alert ('Fail')   
                </SCRIPT>";
        echo($mName);
    }
    $result->close();
    
?>
