Reputation: 2708
I am making form in CakePHP I want the HTML for that form as below
<form action="/abc/sessionapps/login" name="UserLoginForm" id="UserLoginForm" method="post" accept-charset="utf-8">
Till now I have written following code in CakePHP
echo $this->Form->create('User', array('url' => array('controller' => 'sessionapps', 'action' =>'login'),array('name'=>'UserLoginForm')));
It is generating following output
<form action="/abc/sessionapps/login" 0="0" id="UserLoginForm" method="post" accept-charset="utf-8">
Please Help
Thanks in advance
Upvotes: 0
Views: 806
Reputation: 1419
<?php
echo $this->Form->create('User', array('name'=>'UserLoginForm','url' => array('controller' => 'sessionapps', 'action' =>'login')));
?>
Generally we give the model name as the form name so that we get the array as $this->data[Model] and we can save it simply passing this array to the save query.
Upvotes: 1
Reputation: 100175
try:
echo $this->Form->create('User',
array(
'url' => array('controller' => 'sessionapps', 'action' =>'login'),
'name' => 'UserLoginForm'
)
);
Upvotes: 1