Home > Backend Development > PHP Tutorial > php读取textarea的有关问题

php读取textarea的有关问题

WBOY
Release: 2016-06-13 13:37:00
Original
930 people have browsed it

php读取textarea的问题,在线等
textarea文本框提交信息,一行一个的批量提交,php获取之后怎么对他们进行分割,进行逐行读取存入数据库,我试过\n \r \n\r都不行

另外想问下这样获取到的数据怎么一起存入数据库 每行一个数据

------解决方案--------------------
生成 SQL 指令串

PHP code

$ar = preg_splie("/[\r\n]+/", $_POST['text'], 0, PREG_SPLIT_NO_EMPTY);
$sql = "INSERT INTO tbl_name ( textfield ) VALUES "('" . join("'),('", $ar) ."')"; <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template