我无法在表mysql中输入数据。 我的意思是这个代码用于在mysql中使用php插入多个数据textarea,我使用wordpress所以我应该使用前缀或者请给我另一个有效的代码。 如果太多的数据也受到影响,我通常会在textarea中输入超过20的数据,并在一行中输入几个单词
示例数据:
Ivan fore@gmail.com 7612410 ivan 1234qwerty BCA 564649784645 ivan 81598686546 .com
Ivan fore@gmail.com 7612411 ivan 1234qwerty BCA 564649784645 ivan 81598686546 .com
Ivan fore@gmail.com 7612412 ivan 1234qwerty BCA 564649784645 ivan 81598686546 .com
Ivan fore@gmail.com 7612413 ivan 1234qwerty BCA 564649784645 ivan 81598686546 .com
Ivan fore@gmail.com 7612414 ivan 1234qwerty BCA 564649784645 ivan 81598686546 .com
Ivan fore@gmail.com 7612415 ivan 1234qwerty BCA 564649784645 ivan 81598686546 .com
Ivan fore@gmail.com 7612416 ivan 1234qwerty BCA 564649784645 ivan 81598686546 .com
Ivan fore@gmail.com 7612417 ivan 1234qwerty BCA 564649784645 ivan 81598686546 .com
<form class="form-horizontal" role="form" method="post">
<div class="form-group" id="rekowner">
<label for="rekowner" class="col-lg-1 control-label">Pemilik Rekening</label>
<div class="col-lg-8">
<textarea rows="30" cols="700" name="list"></textarea>
</div>
</div>
<div class="form-group">
<center>
<button class="button button-primary" onClick="return confirm('Anda sudah yakin akan menyimpannya?');">Simpan</button>
</center>
<p> </p>
</div>
</form>
&#13;
if($_POST['list']) {
$list = explode("\n",$_POST['list']);
$i=0;
foreach($list as $data) {
$data = str_replace("\t"," ",$data);
$data = @explode(" ",$data);
$nama = trim($data[0]);
$email = trim($data[1]);
$insta_no = trim($data[2]);
$insta_nama = trim($data[3]);
$phone_pass = trim($data[4]);
$bank_nama = trim($data[5]);
$bank_rekening = trim($data[6]);
$bank_pemilik = trim($data[7]);
$no_hp = trim($data[8]);
$group = trim($data[9]);
$wpdb->insert($wpdb->prefix."datamember",
array(
"insta_no"=>$insta_no,
"nama"=>$nama,
"email"=>$email,
"insta_no"=>$insta_no,
"insta_nama"=>$insta_nama,
"phone_pass"=>$phone_pass,
"nama_bank"=>$bank_nama,
"bank_rekening"=>$bank_rekening,
"bank_pemilik"=>$bank_pemilik,
"no_hp"=>$no_hp,
"group"=>$group
));
$i++;
};
?>
答案 0 :(得分:0)
<form class="form-horizontal" role="form" method="post">
<div class="form-group" id="rekowner">
<label for="rekowner" class="col-lg-1 control-label">Pemilik Rekening</label>
<div class="col-lg-8">
<textarea rows="30" cols="700" name="list"></textarea>
</div>
</div>
<div class="form-group">
<center>
<button class="button button-primary" onClick="return confirm('Anda sudah yakin akan menyimpannya?');">Simpan</button>
</center>
<p> </p>
</div>
</form>