Use this:
//form part
<form enctype="multipart/form-data" method="post" action="application/
controller/action/">
        <input type="submit" name="task" value="task_1" />
        <input type="submit" name="task" value="task_2" />
</form>

controllar/action Sctipt:

if($this->params['form']['task] == "task_1")
{
//Your Task_1 code
}
if($this->params['form']['task] == "task_2")
{
//Your Task_2 code
}

Hope it will help you. If it helps u then don't forget to say me
thanks.



On Aug 18, 1:26 pm, anus <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>          Iam a very new beginner to cakephp. Iam struggling with
> multiple submit button in one form(via POST). This is my issue:
>
> I have .ctp page with two submit button like this,
>
>  <?php echo $form->create('Task', array('action' => 'home','type' =>
> 'post')); ?>
>  <?php echo $form->submit('tasks.gif',array('name'=>'Task')); ?>
> <?php echo $form->submit('Go',array('name'=>'Go')); ?>
>  <?php echo $form->end(); ?>
>
> I want to identify which button has clicked(Task button or Go button).
> How can i identify this?I just tried like this..
>
> And in my controller page I have an action "home" like this:
> function home()
>   {
>                 if (isset($this->params['form']['Task']))
>                             {
>                                echo("<SCRIPT LANGUAGE='JavaScript'>
> window.alert(' Task') </SCRIPT>");
>
>                             }
>               if (isset($this->params['form']['Go']))
>                             {
>                                echo("<SCRIPT LANGUAGE='JavaScript'>
> window.alert(' Go') </SCRIPT>");
>
>                             }
>
>   }
>
> But failed .... can anyone plz help me. Struggling with this for last
> few days!!!!!
>
> Thanks

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to