帮助这段代码不起作用,我不知道为什么我是编程/网页设计的新手,因此我需要很多帮助,有些东西,我不会理解,因为我是新手
if (empty($titel) or empty($indhold)) {
$error = 'Alle felter skal udfyldes';
} else {
$query = $pdo->prepare('INSERT INTO artikler (artikel_titel, artikel_indhold) VALUES (?, ?)');
$query->bindValue(1, $titel);
$query->bindValue(2, $indhold);
$query->execute();
header('location: index.php');
}
}
?>
<html>
<head>
<title>Integrere senere</title>
<link rel="stylesheet" href="../assets/style.css">
<link rel="shortcut icon" href="/billeder/book.png">
</head>
<body>
<div class="container">
<a href="index.php" id="logo">CMS</a>
<h4>Add article</h4>
<?php if (isset($error)) { ?>
<small style="color:#FF0004"><?php echo $error ?></small>
<?php } ?>
<br>
<form action="add.php" method="post" autocomplete="off">
<input type="text" name="titel" placeholder="Titel">
<br>
<br>
<textarea name="indhold" cols="50" rows="15" placeholder="Indhold"></textarea>
<br> <br>
<input type="submit" value="Lav ny side">
</form>
</div>
</body>
</html>
<?php
} else {
header('location: index.php');
}
?>
我感谢所有帮助:)