Jeremygolf
Mitglied
Wie fügt es $kategorie nicht zur datebank hinzu? Und wie wäre es richtig?
Danke
Danke
Code:
<?php
if ($_POST['titel'] != "") {
include_once('connect_to_mysql.php');
$numRows = mysql_num_rows($sql);
$kategorie = $_POST["id"];
$id = $_POST["kategorie"];
$datum = $_POST["datum"];
$titel = $_POST["titel"];
$bild = $_POST["bild"];
$text = $_POST["text"];
$sql_insert= mysql_query("INSERT INTO `news` VALUES ('$id', '$kategorie', now(), '$titel', '$bild', '$text')") or die (mysql_error());
}
?>
<?php
session_start();
if (isset($_SESSION["username"])) {
?>
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div id="mainpage">
<div id="navigation"><ul id="navi">
<?php include("php/navi.php"); ?>
</ul>
</div>
<div id="content">
<h1>News</h1>
<?php include('php/news_filter.php'); ?><br/><br/>
<p>Hier kannst du einen neuen Newseintrag machen</p>
<form action="news.php" method="post">
Kategorie: <br/><br/>
<select>
<option value="<?php echo $kategorie; ?>">Normal</option>
<option value="<?php echo $kategorie; ?>">Frucht des Monats</option>
</select><br/><br/>
Titel: <br /> <input name="titel" type="text" value="<?php echo $titel; ?>" /><br />
Bild: <br /> <input name="bild" type="text" value="<?php echo $bild; ?>" /><br />
Bild: <br /> <input style="border: none;" name="bild" type="file" value="<?php echo $bild; ?>" /><br />
Text: <br /> <textarea name="text" cols="35" rows="10" value="<?php echo $text; ?>"></textarea><br />
<input class="button" name="submit" type="submit" value="Publizieren" />
</form>
</div>
</div>
</body>
</html>
<?php
} else {
?>
Bitte erst einlogen, <a href="index.php">hier</a>.
<?php
}
?>