By athom09 on
This may be a basic question, but I am unable to find the answer.
Here is my problem.
I have page that displays results from a DB query.
I have two links per row "Complete" and "Delete".
How can I call a function to update the status of the DB by clicking on one of the links?
Thanks.
Comments
You basically want to create
You basically want to create a menu item of type MENU_CALLBACK. Something like this in hook_menu...
If you wanted to go about it a different way you could make the path something like path/to/%/% and pass in array(2,3). And then the third option would be like an $op variable for one function that you call instead of two. I like to split my functions up personally.
Edit: had this open for like an hour before posting.
is there not some way to call
is there not some way to call PHP from java script?
I think that I understand
I think that I understand what you are saying. However, I need a little further clarification.
I need two params, an id and a status.
1. When I build my link should the path portion look like this "path/%/%/update" or this "path/1/A/update" ?
2. In the menu_hook how do I pass the dynamic params to 'page arguments'? It is my understanding that the menu_hook is defined before the links are created if the links are dynamic.
Is the Array(2) passing the value 2 into the function or is it refering to index value 2 in path where path=0 to=1 %=2?
Thanks
Reload Page after Linking to Function
Your explanation of how to get from a link to a function helped enormously but it ends with a "return 'blah blah blah blah blah';".
This return places you on a new page with the title "Complete" or "Delete" and a line below with the return text, in this case, "blah blah blah blah blah".
What I'd like to do at the end of the function "my_module_delete_function" rather than "return 'blah blah blah blah blah';", is to reload the page that had the initial link on it.
How do I do that?
Sorry, did you figure this
Sorry, did you figure this out Tokoh? I'm looking to implement something similar.
Thanks!
I am also looking for this
I am also looking for this answer, please reply if you got solution ....
Thanks
Specify page after MENU_CALLBACK
I think you may be looking for drupal_goto('your/path/here')
https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_...