By BSmith001 on
function Build_appt() {
.
.
.
$output .= ' [' . l(t('delete'), 'cxr/appt/delete/' ) . $cxr . ']';
}
$output .= '</div>';
$output .= '<div class="cxr_msgt"></div>';
$output .= '<div class="cxr_msg_body" id="msg_'.$id.'">';
$output .= $cxr['msg'];
$output .= '</div>';
$output .= '<div class="cxr_msgb"></div>';
$output .= '</div>';
$output .= '</div>';
}
$output .= '</div>';
}
$output .= '</div>';
}
return $output;
}
// ---
function cxr_appt_delete () {
db_query("DELETE FROM {cxr} WHERE id = %d", $cxr);
drupal_set_message(t('CXR deleted successfully.'));
}
The build function works, but doesn't call the delete function when tested.
I'm trying to pass the cxr var to a delete function in a drupal module, but the delete function isn't getting called when you click on the link.
Am I not passing to it correctly??
Comments
Solution
Hi,
I can see some issues in the above code.
$output .= ' [' . l(t('delete'), 'cxr/appt/delete/' ) . $cxr . ']';this should be like$output .= ' [' . l(t('delete'), 'cxr/appt/delete/' . $cxr['id']) . ']';$crx is an array you cant send a array in the argument, send the id.Hope this will solve your problem.
Thanks,
Suro
thanks, I'll add that and
thanks, I'll add that and see if that works.
What is the arg(3) ?? I've seen it is some of the other code, but didn't get what it was.