Hello friends I am very lay in PDO and would like the help of friends to try to create an INSERT that would register a font name in the BD font table. Next, I created this code below, based on the UPDATE code that is working:
<form name="enter" method="post" action="" enctype="multipart/form-data">
<?php
if(isset($_POST['enter'])){
$pdo = new PDO('mysql:host=localhost;dbname=site', "root", "");
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $pdo->prepare ('INSERT INTO fontes (font) VALUES (:font)');
$stmt->execute(array(':font' => $font));
echo
"<meta http-equiv='refresh' content='0; URL= ../cadastros/cad_fonte.php'>
<script language='javascript'>
window.alert('Dados alterados com sucesso!');
</script>";
}
?>
<h3>Caso a fonte desejada não esteja listada, cadastre-a agora!</h3><br />
<input type="text" name="font" value="" />
<input type="submit" name="enter" value="Cadastrar" />
I ask your friends to help me make a code that works so that I can register.
Thank you in advance.