Hi all,
I am working on a simple PHP database program with MySQL in order to learn PHP. I have a script that reads the DB and lists the records with two links. One to edit the record and one to delete the record. This all works fine. The DB structure is id, slug, content, contact, timestamp. The idea is that when you click on the delete link, it calls another page and in the older style of doing things, we would have passed the record id in the url to the second script and theoretically, all would have been fine. Now with the newer style with the register_global=off, I cannot figure out how to pass this value on to the next script and have it persist. I have used the following:
<?php
if (mysql_num_rows($result) > 0)
{
// iterate through resultset
// print title with links to edit and delete scripts
while($row = mysql_fetch_object($result))
{
?>
<font size="-1"><b><? echo $row->slug; ?></b> [<? echo
formatDate($row->timestamp); ?>]</font> <br>
<font size="-2"><a href="faq_edit.php">edit</a> | <a
href="faq_delete.php?id=<?php (int)$_GET['id']; ?>">delete</a></font>
//originally here in the old style, we used <a
href="faq_delete.php?id=<?php echo $row->id; ?>">delete</a></font> but with the register_globals=off, this no longer works............................
<p>
<?
}
}
// if no records present
// display message
else
{
?>
<font size="-1">No FAQ's currently available</font><p>
I have tried using the new super globals and I think this is what I have to do but I am not sure. It is either that or combine all of the scripts into one?
Please help if you can.
filch