0
I save the input information on the "Save" button and then it says that the information has been entered, but when I go to see the database, there’s nothing there, Someone can help me?
<?php
include "Conexão.php";
if(isset($_POST['Botao']))
{
$PrimeiroNome = $_POST['PrimeiroNome'];
$UltimoNome = $_POST['UltimoNome'];
$Email = $_POST['Email'];
$Telefone = $_POST['Telefone'];
$Endereço = $_POST['Endereço'];
$Aniversario = $_POST['Aniversario'];
$insert = "INSERT INTO 'lista_contactos'('PrimeiroNome', 'UltimoNome', 'Email', 'Telefone', 'Endereço','Aniversario')
VALUES ('$PrimeiroNome','$UltimoNome','$Email','$Telefone','$Endereço','$Aniversario')";
if(!$insert)
{
echo "Erro a inserir!";
}
else
{
echo "Inserido!";
}
}?>
<form method="POST">
<input type="text" name="PrimeiroNome" placeholder="PrimeiroNome">
<input type="text" name="UltimoNome" placeholder="UltimoNome">
<input type="text" name="Email" placeholder="Email">
<input type="text" name="Telefone" placeholder="Telefone">
<input type="text" name="Endereço" placeholder="Endereço">
<input type="date" name="Aniversario" placeholder="Aniversário">
<input type="submit" name="Botao" placeholder="Guardar">
</form>
There are no simple quotes in table and field names. You also need to call/use the database API to send your SQL.
– rray
You only created the query but did not put it on the connection
– Alex
@rray How do I do this exactly? :\
– Rafaël
@Marcelorafael How do I do it myself?
– Rafaël
You have to look for tutorials on the internet to teach you how to do this, I think here would not be very recommended, search youtube for PHP PDO
– Alex
I like this guy: https://www.youtube.com/watch?v=QtCdk459NFg&list=PLfdtiltiRHWHkDwEoZ29Q9FKtWVjA46HC if Voce wrote his question in English should understand
– Alex
@Marcelorafael Thank you very much, I will watch now and try to resolve :D
– Rafaël