i cann't update
Posted: Sat Mar 03, 2012 12:09 pm
hello every body
all i want to do in this project is when you decide to edit a post, by clicking on edit post.
i wanted to show a web form for the user with his old post displayed in the form, and all he have got to do is replacing the old post with news post....
i have the following errors :
Notice: undfined variable: gid in C:\xxxxxx.editnews.php on line 11
Notice: undfined variable: author in C:\xxxxxx.editnews.php on line 25
Notice: undfined variable: titke in C:\xxxxxx.editnews.php on line 25
Notice: undfined variable: content in C:\xxxxxx.editnews.php on line 25
line 25 where i am actually update = mysql_query( .................)
any suggetions please i have working on this simple project over 10 hours now and i don't know what to do anymore
all i want to do in this project is when you decide to edit a post, by clicking on edit post.
i wanted to show a web form for the user with his old post displayed in the form, and all he have got to do is replacing the old post with news post....
i have the following errors :
Notice: undfined variable: gid in C:\xxxxxx.editnews.php on line 11
Notice: undfined variable: author in C:\xxxxxx.editnews.php on line 25
Notice: undfined variable: titke in C:\xxxxxx.editnews.php on line 25
Notice: undfined variable: content in C:\xxxxxx.editnews.php on line 25
line 25 where i am actually update = mysql_query( .................)
any suggetions please i have working on this simple project over 10 hours now and i don't know what to do anymore
<?php #1. Connecting to database # require("SQL_connect.php"); #-------------------------# if(isset($_GET['id'])){ $gid = $_GET['id']; } $data = mysql_query("SELECT * FROM addnews WHERE id='$gid'") or die("CANNOT EXCUTE SELECTION"); while($row = mysql_fetch_assoc($data)){ $author = $row['author']; $title = $row['title']; $content = $row['content']; } #-------FORM HERE-----------# if(isset($_POST['author'],$_POST['title'],$_POST['content'])) { $update = mysql_query("UPDATE news_system SET author='$author', title='$title', content='$content' WHERE id='$gid'") or die("Something went wrong: Please Try again later.."); } echo "<form action='".$_SERVER['PHP_SELF']."' method='POST'> Author:<br/> <input type='text' name='author' value='".$author."' size='35px'/><br/> Title:<br/> <input type='text' name='title' value='".$title."' size='35px' /><br/> Content:<br/> <textarea name='content' rows='5' cols='50' >".$content."</textarea><br/> <input type='submit' value='update' /> </form>"; ?>