Lernender
Hallo. Ich versuche mich mithilfe dieses Tutorials an einem eigenen CMS. Mein Problem ist nun, dass ich keine Artikel speichern kann. Hier der Code von newArticle.php wie ich ihn habe. Wenn mehr Code zur Lösung benötigt wird einfach fragen
Ich hoffe ihr findet den Fehler.. sitze da schon zwei Tage dran und beginne zu verzweifeln.
Ich hoffe ihr findet den Fehler.. sitze da schon zwei Tage dran und beginne zu verzweifeln.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Serif WebPlus 11.0.0.022">
<title>Administrator</title>
<style type="text/css">
<!--
body {margin: 0px; padding: 0px;}
a:link {color: #2c3651;}
a:visited {color: #1f5b8b;}
a:hover {color: #2c3651;}
a:active {color: #2c3651;}
.Normal-P
{
margin:0.0px 0.0px 0.0px 0.0px; text-align:left; font-weight:400;
}
.Normal-C
{
font-family:"Verdana", sans-serif; font-size:16.0px;
line-height:1.13em;
}
-->
</style>
</head>
<body text="#000000" style="background: #ffffff; text-align:center; height:500px;">
<div style="background: transparent; position:relative;width:750px;height:500px;margin-left:auto;margin-right:auto;">
<div style="position:absolute; left:112px; top:105px; width:106px; height:22px; text-align:left;">
<input type="text" id="edit_2" name="edit_2" size="13" width="106px;" value="">
</div>
<div style="position:absolute; left:112px; top:155px; width:106px; height:22px; text-align:left;">
<input type="text" id="edit_3" name="edit_2" size="13" width="106px;" value="">
</div>
<div style="position:absolute; left:112px; top:130px; width:106px; height:22px; text-align:left;">
<input type="text" id="edit_4" name="edit_2" size="13" width="106px;" value="">
</div>
<div style="position:absolute; left:112px; top:181px; width:411px; height:182px; text-align:left;">
<textarea id="text_2" rows="11" cols="48" name="text_2" style="height:100%; width:411px;"></textarea>
</div>
<div style="position:absolute; left:47px; top:157px; width:81px; height:19px;">
<div class="Normal-P">
<span class="Normal-C">Sektion</span></div>
</div>
<div style="position:absolute; left:47px; top:107px; width:57px; height:19px;">
<div class="Normal-P">
<span class="Normal-C">Titel</span></div>
</div>
<div style="position:absolute; left:47px; top:132px; width:80px; height:19px;">
<div class="Normal-P">
<span class="Normal-C">Tagline</span></div>
</div>
<div style="position:absolute; left:47px; top:184px; width:73px; height:19px;">
<div class="Normal-P">
<span class="Normal-C">Artikel</span></div>
</div>
<div style="position:absolute; left:422px; top:156px; width:101px; height:22px; text-align:left;">
<input type="submit" id="butn_2" value="Speichern">
<?php
require_once('../includes/DbConnector.php');
if ($HTTP_POST_VARS){
$connector = new DbConnector();
$insertQuery = "INSERT INTO cmsarticles (title,tagline,section,thearticle) VALUES (".
"'".$HTTP_POST_VARS['title']."', ".
"'".$HTTP_POST_VARS['tagline']."', ".
$HTTP_POST_VARS['section'].", ".
"'".$HTTP_POST_VARS['thearticle']."')";
if ($result = $connector->query($insertQuery)){
echo '<center><b>Article added to the database</b></center><br>';
}else{
// It hasn't worked so stop. Better error handling code would be good here!
exit('<center>Sorry, there was an error saving to the database</center>');
}
}
?>
</div>
</div>
</body>
</html>