Textarea不会将记录添加到mysql中

时间:2019-07-10 08:49:45

标签: php mysql

非常感谢您的帮助。 外形小巧。填充后,将记录添加到mysql中。如果我在textarea中添加了短文本,则一切正常。

我想添加大约600个字符的文本,但是那不起作用。什么都没有添加到mysql中。

这是我的代码的一部分,希望有人能帮助我。

CREATE TABLE IF NOT EXISTS `videos` (
`video_id` int(11) NOT NULL,
`video_title` varchar(255) NOT NULL,
`video_url` varchar(255) DEFAULT NULL,
`video_link` varchar(255) DEFAULT NULL,
`video_date` date DEFAULT NULL,
`video_category` varchar(255) DEFAULT NULL,
`video_description` longtext,
`video_keywords` varchar(255) NOT NULL,
`added` datetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=291 DEFAULT CHARSET=utf8;

    function adminAddVideo() {
global $conn;

....

echo "<div class='form-group'>";
echo "<label for='title'>Popis</label>";
echo "<textarea rows='10' class='form-control' name='video_description'></textarea>";
// echo "<div id='charNum'>dsa</div>";
echo "</div>";

....

echo "<div class='form-group'>";
echo "<input type='submit' class='btn btn-primary' name='admin_add_video' value='Pridať video '>";
echo "<br /><a href='/admin'>Návrat</a>";
echo "</div>";

echo "</form>";

echo "</div>";
echo "</div>";

if (isset($_POST['admin_add_video'])) {
$video_id = $_POST['video_id'];
$video_title = $_POST['video_title'];
$video_url = $_POST['video_url'];
$video_link = $_POST['video_link'];
$video_date = $_POST['video_date'];
$video_category = $_POST['video_category'];
$video_keywords = $_POST['video_keywords'];
$video_description = $_POST['video_description'];

if (($video_title == "")OR($video_link == "")) {
echo "<div class='formerror text-center'>Nevyplnili ste všetky položky.</div>";
}
else {
$sql = "INSERT INTO videos (video_title, video_url, video_link, video_date, video_category, video_description, video_keywords, added) VALUES ('$video_title','$video_url','$video_link','$video_date','$video_category','$video_description','$video_keywords',NOW())";


if ($conn->multi_query($sql) === TRUE) {
echo "Video bolo úspešne pridané";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
// header ("refresh:3;url=index.php");
}
}
}

0 个答案:

没有答案