Im trying to follow a tutorial thats a little dated when it comes to the newer PHP and this one I cannot for the life of me figure out. (Probably becasue im not very good with PHP yet) but here are the errors im getting:
PHP Notice: Undefined index: title in E:\Web\WebServer\htdocs\CMS\cmsadmin\newArticle.php on line 20, referer: http://localhost/CMS/cmsadmin/article.html
[Tue Jul 24 13:12:41 2007] [error] [client 127.0.0.1] PHP Notice: Undefined index: tagline in E:\Web\WebServer\htdocs\CMS\cmsadmin\newArticle.php on line 21, referer: http://localhost/CMS/cmsadmin/article.html
[Tue Jul 24 13:12:41 2007] [error] [client 127.0.0.1] PHP Notice: Undefined index: section in E:\Web\WebServer\htdocs\CMS\cmsadmin\newArticle.php on line 22, referer: http://localhost/CMS/cmsadmin/article.html
here is the newArticle.php lines
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<?php
// Get the PHP file containing the DbConnector class
require_once('../includes/DbConnector.php');
// Check whether a form has been submitted. If so, carry on
if ('$HTTP_POST_VARS'){
// Create an instance of DbConnector
$connector = new DbConnector();
// IMPORTANT!! ADD FORM VALIDATION CODE HERE - SEE THE NEXT ARTICLE
// Create an SQL query (MySQL version)
$insertQuery = "INSERT INTO cmsarticles (title,tagline,section,thearticle) VALUES (".
"'".$POST['title']."', ".
"'".$POST['tagline']."', ".
$POST['section'].", ".
"'".$POST['thearticle']."')";
// Save the form data into the database
if ($result = $connector->query($insertQuery)){
// It worked, give confirmation
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>');
}
}
?>
<body>
<form name="form1" method="post" action="newArticle.php">
<p> Title:
<input name="title" type="text" id="title">
</p>
<p> Tagline:
<input name="tagline" type="text" id="tagline">
</p>
<p> Section:
<input name="section" type="text" id="section">
</p>
<p> Article:
<textarea name="thearticle" cols="50" rows="6" id="thearticle"></textarea>
</p>
<p align="center">
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>