HTML form input field with comma separated

前端 未结 4 1195
梦毁少年i
梦毁少年i 2021-01-23 22:38

I am trying to figure out how to take multiple word input in a single text box in a form with each word separated by comma(,) and then paring the word based on comma and inserti

4条回答
  •  深忆病人
    2021-01-23 23:29

    $str = $_POST['words'];
    $piece = explode(',',$str);
    foreach($piece as $substr){
        mysql_query("INSERT INTO test (words) VALUES ('".$substr."');";
    }
    

提交回复
热议问题