I have a simple PHP/MySQL database site. On this particular page I have a table array of records. I want to be able to click an 'Edit' link that will then end the appropriate record to the edit_date.php. Each record has a record 'id'. My problem is I'm not sure how to pass the 'id' variable from the array to the edit_date.php and to use it to delete records. Any help would be great. Here is my code so far:
<?php
########################################
Modify Tour Date entries
#######################################
require 'functions.php';
// Check whether the user is already authenticated or not
if (!authenticateUser( $cookie_admin, $cookie_pass)){
header("Location:http://$http_host/$prefix/index.html");
exit();
}
// Connect to the Database
if (!($link = mysql_pconnect($dbhost, $dbuser, $dbpass))){
DisplayErrMsg(sprintf("internal error %d:%s\n",
mysql_errno(), mysql_error()));
exit() ;
}
?>
<HEAD>
<TITLE>Modify Tour Dates</TITLE>
<link rel="stylesheet" href="style.css" type="text/css">
</HEAD>
<BODY>
<?php
include ("header.htm");
?>
<TABLE border="0" cellpadding="0" cellspacing="0" width="90%">
<tr>
<td width="100%" class="t2">Modify Tour Dates</td>
</tr>
<tr>
<td class="L1"> </td>
</tr>
</TABLE>
<TABLE border="0" cellpadding="0" cellspacing="0" width="90%">
<TR>
<TD width="100%">
<?php
// Send the Query to the Server, to get tour dates
if (!($result = mysql_db_query($db,"SELECT * FROM dates ORDER BY date_mm ASC")))
{
DisplayErrMsg(sprintf("internal error %d:%s\n",
mysql_errno(), mysql_error()));
return 0 ;
}
// Display the Items
while(($row = mysql_fetch_array($result)))
{
?>
<TABLE border="0" cellpadding="1" cellspacing="1" width="400">
<tr>
<td width="12%" class="t2">Date:</td>
<TR>
<TD width="12%" class="t1"><?php echo $row[("date_mm")];?>/<?php echo $row[("date_dd")];?>/<?php echo $row[("date_yy")];?>
</td>
</tr>
<TR>
<TD width="12%" class="t1"><?php echo $row[("venue")];?></td>
</tr>
<TR>
<TD width="12%" class="t1"><?php echo $row[("city")];?>, <?php echo $row[("state")];?></td>
</tr>
<TR>
<TD width="12%" class="t1"><?php echo $row[("guests")];?></td>
</tr>
<TR>
<TD width="12%" class="t1"><?php echo $row[("info")];?></td>
</tr>
<TR>
<TD width="12%" class="L1"><a href="edit_date.php?edit_id='<?php $row["$id"];?>'">//this does not work//Edit</a> | Delete</td>
</tr>
<TR>
<TD width="12%" class="t1"><input type="checkbox" name="DeleteItems[]" value="$id"></td>
</tr>
<TR>
<TD width="12%" class="t1"> </td>
</tr>
</TABLE>
<?php
} // End of while loop
?>
</TD>
</TR>
</TABLE>
</BODY>