[wp-hackers] Delete Row After Submit - Undefined
BenderisGreat
greglancaster71 at gmail.com
Fri Oct 11 20:13:57 UTC 2013
I have an issue that is apparently ongoing that I didnt realize until I
turned on debug mode. I have a delete button on every row of a table, and
when clicked it grabs the row ID and erases that information. However it
also grabs a field from the picture row (its a post id for the image
attachment) and attempts to delete that as well.
<?php
if (isset($_POST['id'])) {
$id = $_POST['id'];
if (isset($_POST['deleteItem'])) {
get_delete_post_link( get_the_ID( $row['file']));
$qry = "DELETE FROM wp_jo_plugin_options WHERE id = ".$id."";
$jo_remove_row = $wpdb->query($qry);
}
}
?>
The problem is that its telling me that $row is an undefined variable. If I
put it inside the while loop it works, but then the page requires a refresh
after deletion because the table is loaded before the delete code is. Is
there any solution to this? Possible to redefine a variable upwards in the
document order possibily?
--
View this message in context: http://wordpress-hackers.1065353.n5.nabble.com/Delete-Row-After-Submit-Undefined-tp42521.html
Sent from the Wordpress Hackers mailing list archive at Nabble.com.
More information about the wp-hackers
mailing list