index.php: <html> <head></head> <body> <!-- standard page header --> <?php // includes include('crm_conf.php'); // open database connection $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect!'); // select database mysql_select_db($db) or die ('Unable to select database!'); // generate and execute query $query = "SELECT * FROM Cust_tbl ORDER BY custName"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // if records present 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><?php echo $row->custID; ?></b>[<?php echo $row->custName; ?>]</font> <br> <font size="-2"><a href="crm_edit1.php?id=<?php echo $row->custID; ?>"> edit</a> | <a href="crm_delete.php?id=<?php echo $row->custID; ?>"> delete</a></font> <p> <?php } } // if no records present // display message else { ?> <font size="-1">No releases currently available</font><p> <?php } // close connection mysql_close($connection); ?> <font size="-2"><a href="crm_add.php">Add New</a></font> <!-- standard page footer --> </body> </html> crm_delete.php <html> <p>Are you sure you want to delete this customer?</p> <form action="crm_delete2.php" method="post"> Your choice: <input type="radio" name="choice" value="yes"> Yes <input type="radio" name="choice" value="no" /> No <input type="hidden" name="id" id="id" value="<?php echo $_REQUEST['id'];?>"> <button type="submit">Send</button> </form> </html> crm_delete2.php <?php // includes include('crm_conf.php'); // check for record ID if ((!isset($_GET['id']) || trim($_GET['id']) == '')) { die('Missing record ID!'); } // open database connection $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect!'); // select database mysql_select_db($db) or die ('Unable to select database!'); if (isset($_POST['choice']) ) { switch($_POST['choice']) { case 'yes': /// Code here $id = (int)$_POST['id']; $query = "DELETE FROM Cust_tbl WHERE custID = '$id'"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); if (@mysql_query($query)) { echo '<p>The manager has been deleted.</p>'; echo '<a href=index.php>Go back to the main menu</a>.</font>'; } else { echo '<p>Error deleting customer: ' . mysql_error() . '</p>'; } break; case 'no': /// Code here break; default: /// Error treatment break; } } else { // error treatment } // close database connection mysql_close($connection); ?> PROBLEM: When I hit Delete I got crm_delete.php page which is right but when I hit SEND button Im stuck on this statement: // check for record ID if ((!isset($_GET['id']) || trim($_GET['id']) == '')) { die('Missing record ID!'); } Which is suspect the value I passed to crm_delete.php page is missing. Please I need all you help. TIA! Dynx
In crm_delete.php page, you have form method is POST. And in your processing page crm_delete2.php, you try to get value via $_GET. So that's the error.