Man, my coding is getting better. I see no problems with this, nor does Beau. But the problem is this: It wont insert the info into the database! I don't get any error messages or anything... the vars work, I've tested. It's just not putting anything into the db!
Tell me whats wrong!PHP Code:<?php
include 'config.php';
session_start();
$date = date("d/m/Y");
foreach($_POST as $key=>$val) {
$$key = clean($val);
}
if ($_SESSION['logged_user'] == true) {
$query = mysql_query("SELECT * FROM `users` WHERE `username` = '".$_SESSION['logged_user']."'");
$rows = mysql_fetch_array($query);
if ($rows['level'] == 5) {
if ($_POST['submit']) {
echo "News added!";
$sql = mysql_query("INSERT INTO `news` (title, shortcontent, content, by, date) VALUES ('$title','$shortcontent','$content',''".$_SESSION['logged_user']."'','$date')");
}
if (!$_POST['submit']){
echo "<form action=\"addnews.php\" method=\"POST\">
News title: <input type=\"text\" size=\"20\" name=\"title\">
</br>
</br>
Short content: <input type=\"text\" size=\"20\" name=\"shortcontent\">
</br>
</br>
Content: <input type=\"text\" size=\"20\" name=\"content\">
</br>
</br>
<input type=\"submit\" name=\"submit\" value=\"Add news!\">
</form>
";
}
} else {
echo "You're not meant to be here, shoo. <meta http-equiv=\"REFRESH\" content=\"1;url=./members.php\">";
}
} else {
echo "Not logged in... Redirecting... <meta http-equiv=\"REFRESH\" content=\"1;url=./login.php\">";
}
?>![]()









