dbConnector and settings all come from the same script. (Any suggestions as to whay this is a bad ideal?) I did this to avoid the earlier stated problems i was having.
Code:
<html>
<head>
<title>New Article</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<?php
$username = "00011";
$password = "quzar12s";
$hostname = "localhost";
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
$title = $HTTP_POST_VARS['title'];
$tagline = $HTTP_POST_VARS['tagline'];
$section = $HTTP_POST_VARS['section'];
$thearticle = $HTTP_POST_VARS['thearticle'];
echo $title;
echo $tagline;
echo $section;
echo $thearticle;
$query = "INSERT INTO cmsarticles (title, tagline, section, thearticle) VALUES
('$title', '$tagline', '$section', '$thearticle')";
mysql_query($query) or die('Error, insert query failed');
?>
<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>
This is the newArticle.php file I am currently using. When it runs I get an error message that says the insert query fails, why?
The echo command succesfully output the contents of the post btw.