0

i have a login system in place, i decided it may be a good idea to have a news section, which i can update from my admin login.

I created a row called 'tdanews'. now i have manually inserted some info into it, and echo'd it into the users login, it works fine, now i have tried to make a script so i can submit a form from my admin page to updte it, but i cant get it to work, any advice?

my code..

<?php
session_start();
if (!isset($_SESSION)) {
echo 'Please <a href="login.php">log in</a> to access your account';
exit();
}
include_once "connection.php";
// Place Session variable 'id' into local variable
$id = $_SESSION;
// Process the form if it is submitted
if ($_POST) {
$tdanews = $_POST;
$sql = mysql_query("UPDATE thedriving3 SET tdanews='$newtdanews' WHERE id='$id'");
echo 'Your account info has been updated, visitors to your profile will now see the new info.';
exit();
}
else
echo "error";// close if post
?>
<?php
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT * FROM members WHERE id='$id' LIMIT 1");
while($row = mysql_fetch_array($sql)){
$tdanews = $row["tdanews"];
}
?>

thanks

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by rajarajan07
0
$newtdanews

Where this coming from? I think your statement should like this

[B]$newtdanews[/B] = $_POST['tdanews'];
$sql = mysql_query("UPDATE thedriving3 SET tdanews='$newtdanews' WHERE id='$id'");
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.