<div id="add_comment">
<div class="add_comment">
<form class="form" method="POST" action="/shablon.php?id=<?php echo $vidos['id']; ?> #add_comment">
<?php
if(isset($_POST['do_post']) )
{
$errors = array();
if($_POST['name'] == '')
{
$errors[] = 'Ведите имя!';
}
if($_POST['text'] == '')
{
$errors[] = 'Ведите текст!';
}
if( empty($errors))
{
mysqli_query($connection,"INSERT INTO `comment` (`name`,`date`,`text_comment`,`page_id`) VALUES('".$_POST['name']."','".$_POST['text']."', NOW(), '".$vidos['id']."')");
echo '<span style="color: green; font-weight:bold;margin-bottom:10px;display:block;">Комментрий успешно добавлен</span>';
} else
{
echo $errors['0'];
}
}
?>
<div class="row">
<input type="text" name="name" class="form__conrol" placeholder="Ваше имя" >
</div>
<div class="text">
<textarea class="textarea" cols="40" rows="3" name="text" placeholder=""></textarea>
</div>
<div class="add_submit">
<input type="submit" name="do_post" value="Добавить камментраий" class="form__conrol">
</div>
</form>
</div>
</div>