Hi
I want to know if there is a way to get the primary key of an inserted element, and use it to redirect to another controller and function using the key as parameter.
[color=#282828][font=helvetica, arial, sans-serif]I have an example from a previous post :[/font][/color]
[color=#000000]$crud[/color][color=#666600]->[/color][color=#000000]set_lang_string[/color][color=#666600]([/color][color=#008800]'insert_success_message'[/color][color=#666600],[/color]
[color=#000000] [/color][color=#008800]'Your data has been successfully stored into the database.<br/>Please wait while you are redirecting to the list page.
<script type="text/javascript">
window.location = "'[/color][color=#666600].[/color][color=#000000]site_url[/color][color=#666600]([/color][color=#000000]$controller[/color][color=#666600].[/color][color=#008800]'/'[/color][color=#666600].[/color][color=#000000]$function[/color][color=#666600].[/color][color=#008800]'/'[/color][color=#666600].[/color][color=#000000]$primary_key[/color][color=#666600]).[/color][color=#008800]'";
</script>
<div style="display:none">
'[/color]
[color=#000000] [/color][color=#666600]);[/color]
[color=#282828][font=helvetica, arial, sans-serif]Thanks for your help [/font][/color]
Get the insert key before redirect
Started by walter.wabe, 12 September 2012 - 17:28 PM
- Single Page
Posted 12 September 2012 - 17:28 PM
Posted 13 September 2012 - 01:24 AM
Your question seems a bit confused. However if you want redirect to another controller after the insert action you can use callback_after_insert () function.
If you want redirect to another controller with the last inserted element in the grid, try create a session to grab the last element.
If you want redirect to another controller with the last inserted element in the grid, try create a session to grab the last element.