I'm trying to write from my database into my page, using one effect. The objective is, when it writes my comment on the page, show it with an effect.
<?php
if(count($_POST) > 0){
echo '<script language="javascript">';
echo '$( "#toggle" ).toggle( "drop" );';
echo '</script>';
$db = new mysqli("localhost", "root", "usbw", "trab_projeto");
$qr = $db->query("INSERT INTO comments(comment) VALUES ('{$_POST['mensagem']}')");
echo "<fieldset id='toogle'>";
echo "<p>";
$row = $db->query("SELECT * FROM comments ORDER BY comment_id DESC LIMIT 1")->fetch_assoc();
echo $row["comment"];
echo "</p>";
echo "</fieldset>";
}
?>
The part of the script doesn't work. These code is executed when I click on a submit form.
<div class="cadastro">
<form action="" id="form-msg" method="post" enctype="multipart/form-data">
<fieldset>
<p>
<span><b>Escreva aqui o seu comentário:</b></span><br>
<textarea name="mensagem" style="margin: 0px; width: 511px; height: 119px;"></textarea>
</p>
<input type="submit" value="Enviar">
</fieldset>
</form>
</div>