I have a database, for a articles system, and I have a table, and in this table, I have articles, and I know its putting it there, because the rest is there, and the query is right because, I accidently left off the $ in the variable of what to put in there, and it put the variable name into the database, but the data is being lost somewhere in between the form, the variable being set, and the insertion into the database.
Here is the code for my html form:
[code=html]<form action=”newArticle.php” method=”post”>
<b>Title: </b><input type=”text” name=”title”><p>
<b>Tagline: </b><input type=”text” name=”tagline”><p>
<b>Section: </b><input type=”text” name=”section”><p>
<b>Article: </b><textarea name=”thearticle” cols=”50″ rows=”6″></textarea><p>
<input type=”submit” value=”Submit” name=”submitarticle”><input type=”reset”>
</form>
Here is my code for the variables and the insertion into the database:
[code=php] $title = $_POST[‘title’];
$tagline = $_POST[‘tagline’];
$section = $_POST[‘section’];
$thearticle = $_POST[‘thearticle’];
$insertQuery = “INSERT INTO cmsarticles (title, tagline, section, thearticle) VALUES (‘$title’, ‘$tagline’, ‘$section’, ‘$thearticle’)”;
Note: The actuall insertion is done later, but this is the code that sets it up.
Another Note: the article column in the table is “thearticle text latin1_swedish_ci Yes NULL” and thats, “Field Type Collation Null Default”