Jump to content

Delete redirect to same page, parsing ID


mrt003003

Recommended Posts

Hi there i have some delete link and processing code here:

 

<?php 
planet.php page

echo'<a href="http://localhost/swb/cancelship.php?recordID='.$row_Ships['ShipID'].'" class="arialred" style="color: #FF0000">Cancel</a>';

cancelship.php page

if ((isset($_GET['recordID'])) && ($_GET['recordID'] != "")) {
  $deleteSQL = sprintf("DELETE FROM ships WHERE ShipID=%s",
                       GetSQLValueString($_GET['recordID'], "int"));

  mysql_select_db($database_swb, $swb);
  $Result1 = mysql_query($deleteSQL, $swb) or die(mysql_error());

  $deleteGoTo = "planet.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
    $deleteGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $deleteGoTo));
}?>

 

The trouble is that the page the delete links on  is determined by an ID from a different table. After i delete the record i wish to remain on the original page but parse the PlanetID. At the moment it just loads the original page again but because it doesnt parse the PlanetID so the page doesnt work.

 

Original page that has the delete link has PlanetID key. From that you are given a list of these delete links with their own key ShipID, which is used to delete those records.

 

So how can i parse the PlanetID back????

 

Thanks   

Link to comment
https://forums.phpfreaks.com/topic/248294-delete-redirect-to-same-page-parsing-id/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.