现在我将其提交到textarea:
1|Value
此插入到数据库中:
-------------------
Column1 | Column2
1 | Value
-------------------
现在,我想通过按Enter键将这些结果添加到多行中,请帮助我添加它 这是我的HTML索引代码:
<form method="POST" action="add.php">
<div class="form-group">
<label for="chonphim">Film:</label>
<select class="form-control" name="chonphim" id="chonphim">
<option value="kono-yo-no-hate-de-koi-wo-utau-shoujo-yu-no_JZ93Q">Phim Kono Yo no Hate de Koi wo Utau Shoujo YU-NO</option>
</select>
</div>
<div class="form-group">
<label for="player">Multiple row and data:</label>
<textarea class="form-control" id="player" name="player" rows="4" placeholder="1|Value1
2|Value2
3|Value3"></textarea>
</div>
<center>
<div class="form-group">
<button style="margin-top: 15px;" class="btn btn-primary active" type="submit" >Add value</button></div></center>
</form>
这是add.php
$chonphim=$_POST['chonphims'];
$player = escape_string($_POST['player']);
$player1 = explode("|", $player);
$tapphim = $player1[0];
$linkplayphim = $player1[1];
$sql2 = "UPDATE vohuunhan_film SET settime = settime + 1 WHERE link = '$chonphim'";
$sql88 = "INSERT INTO vohuunhan_episode (tap, linkplay, id_film)
VALUES (N'$tapphim', N'$linkplayphim', N'$chonphim');";
if ($connect->query($sql88) === TRUE && $connect->query($sql2) === TRUE) {
echo "Success !";
} else {
echo "Error: " . $connect->error;
}
我想要:
1|Value1
2|Value2
3|Value3
插入数据库:
-------------------
Column1 | Column2
1 | Value1
2 | Value2
3 | Value3
-------------------