1
I’m starting with PHP and I’m having trouble sending to the database, unfortunately I can’t find the error, if anyone can help, grateful.
The HTML is like this:
<form method="post" action="blog.php" >
<input style="font-family:'open sans',sans-serif;font-size:20px;color:#212121"type="text" name="titulo" placeholder="Título" required />
<br>
<input type="text" name="texto" placeholder="Texto" required />
<br>
<input style="background-color:red;color:white" type="submit" name="submit" value="enviar" />
</form>
And PHP like this:
<?php
$titulo = $_POST ['titulo'];
$texto = $_POST ['texto'];
$imagem = "imagem";
echo "$titulo";
$conexao = mysqli_connect("localhost", "root", "", "blog");
mysqli_query($conexao, "INSERT INTO postagens (titulo,texto,imagem) VALUES ('$titulo','$texto,'$imagem')");
echo "Sucesso";
?>
The name of the database is 'Blog' and the table 'posts'.
Which texts appear on the screen? Gives some error message?
– Woss