newbie needs help with code yet again
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
the code has come from this page if you scroll down there is a 3 part tutorial for a news system I havent changed anything that I shouldnt of.
http://www.oxyscripts.com/tutorial_cat.php?cat=php
http://www.oxyscripts.com/tutorial_cat.php?cat=php
Code: Select all
<form name="post news" method="post" action="post_news_process.php">
<p>Title :
<input type="text" name="title"><br>
Author :
<input type="text" name="author">
<br>
News :<br>
<textarea name="news" cols="40" rows="6"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="POST !">
</p>
</form>hmmm...if there is a <form> is the method-property set to "POST" or "GET" or isn't set at all?
POST: oops, you have a serious problem with your server
GET: try
edit: ahem, where does the id come from? It's not within the form, is it?
POST: oops, you have a serious problem with your server
GET: try
Code: Select all
$query = "DELETE FROM news WHERE id = ".$_GETї'id'];don't think so.
I took a (very) brief overview on the tutorial.
EDIT: and I took a second look
?
Then with php version <= 4.1.0 $id should contain the id.
From 4.2.x it should be in $_GET['id']
I took a (very) brief overview on the tutorial.
EDIT: and I took a second look
ok, so you added something like/* Now lets display the titles */
echo "<A HREF=\"edit_process.php?id=$id\">$title</A><BR>";
}
[...]using your knowledge that you have gleened from these 3 tutorials, and using the query DELETE FROM news WHERE id = $id
Code: Select all
echo "<A HREF="edit_delete.php?id=$id">$title</A><BR>";Then with php version <= 4.1.0 $id should contain the id.
From 4.2.x it should be in $_GET['id']
Last edited by volka on Fri Aug 16, 2002 5:46 am, edited 1 time in total.
when pointing the mouse over that link does the status bar of the browser show you the right url?
i.e. http://localhost/delete_save.php?id=23
i.e. http://localhost/delete_save.php?id=23
the tutorial assumes that you can access data from href="script.php?id=12" simply by $id
But now you have to use $_GET['id'] by default.
this change of behaviour is the topic of this thread
But now you have to use $_GET['id'] by default.
this change of behaviour is the topic of this thread