Zergman Posted July 22, 2008 Share Posted July 22, 2008 So i've used Dreamweaver to help with this task but have left it behind since its not working. I retrieve my record to delete and pass it to the delete page using <a href="tracker_del.php?recordID=<?php echo $row_rsdatadisplay['id']; ?>">Del</a> On tracker_del.php, I have this <?php session_start(); ?> <?php require_once('Connections/cntrackanator.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } if ((isset($_GET['hiddendelete'])) && ($_GET['hiddendelete'] != "")) { $deleteSQL = sprintf("DELETE FROM ``data`` WHERE id=%s", GetSQLValueString($_GET['hiddendelete'], "int")); mysql_select_db($database_cntrackanator, $cntrackanator); $Result1 = mysql_query($deleteSQL, $cntrackanator) or die(mysql_error()); $deleteGoTo = "tracker_main.php"; if (isset($_SERVER['QUERY_STRING'])) { $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?"; $deleteGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $deleteGoTo)); } $colname_rsdelete = "-1"; if (isset($_GET['recordID'])) { $colname_rsdelete = $_GET['recordID']; } mysql_select_db($database_cntrackanator, $cntrackanator); $query_rsdelete = sprintf("SELECT * FROM `data` WHERE id = %s", GetSQLValueString($colname_rsdelete, "int")); $rsdelete = mysql_query($query_rsdelete, $cntrackanator) or die(mysql_error()); $row_rsdelete = mysql_fetch_assoc($rsdelete); $totalRows_rsdelete = mysql_num_rows($rsdelete); ?> And my form <body> <form action="" method="post" name="form1" id="form1"> <input name="hiddendelete" type="hidden" id="hiddendelete" value="<?php echo $row_rsdelete['id']; ?>" /> Delete <?php echo $row_rsdelete['stn']; ?> ? <label> <input type="submit" name="button" id="button" value="Submit" /> </label> </form> </body> When I click the submit button, nothing happens. Record does not delete and I just stay on the delete page. Help? Link to comment https://forums.phpfreaks.com/topic/115985-delete-record-page-not-working/ Share on other sites More sharing options...
gnawz Posted July 22, 2008 Share Posted July 22, 2008 Hi Since you are not submitting anything, The delete function is an action not event really So you should append a delete button or link against to it. If say, you have appended a link, it should invoke the delete action where ID = $Id. Link to comment https://forums.phpfreaks.com/topic/115985-delete-record-page-not-working/#findComment-596458 Share on other sites More sharing options...
Zergman Posted July 22, 2008 Author Share Posted July 22, 2008 k, I hate to sound too much like a newb, but would you be able to give me an example? Not really sure what I need to change in my code Link to comment https://forums.phpfreaks.com/topic/115985-delete-record-page-not-working/#findComment-596995 Share on other sites More sharing options...
secoxxx Posted July 22, 2008 Share Posted July 22, 2008 i would delete the contents of the delete page and try again. are you using the delete wizard? if you want to message me via yahoo, msn or icq i can walk you through this, in a good 5 minutes. yahoo: [email protected] msn: [email protected] ICQ: 465087281 Link to comment https://forums.phpfreaks.com/topic/115985-delete-record-page-not-working/#findComment-596999 Share on other sites More sharing options...
Zergman Posted July 23, 2008 Author Share Posted July 23, 2008 I have tried using Dreamweaver wizard, tutorials and sample code I could find from previous projects. This one is really stumping me. Link to comment https://forums.phpfreaks.com/topic/115985-delete-record-page-not-working/#findComment-597125 Share on other sites More sharing options...
secoxxx Posted July 23, 2008 Share Posted July 23, 2008 im online now, hit me up ill walk you through it, you might be missing 1 thing Link to comment https://forums.phpfreaks.com/topic/115985-delete-record-page-not-working/#findComment-597206 Share on other sites More sharing options...
LemonInflux Posted July 23, 2008 Share Posted July 23, 2008 Another reason why I went to notepad++. ---------------- Now playing: Linkin Park - Kyur4 Th Ich (Chairman Hahn) via FoxyTunes Link to comment https://forums.phpfreaks.com/topic/115985-delete-record-page-not-working/#findComment-597307 Share on other sites More sharing options...
Zergman Posted July 23, 2008 Author Share Posted July 23, 2008 Another reason why I went to notepad++. LOL, if I only had the smarts to do that ... but I admit, I still need dreamweaver to help on certain things. But I am learning slowly Link to comment https://forums.phpfreaks.com/topic/115985-delete-record-page-not-working/#findComment-597327 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.