previously using cake bake command i had the methods to register which was working fine but later i followed the bookmark tutorial but now both are not working
//in ctp
<?= $this->Form->create('userDetail',array('url' => '/UserDetails/register')); ?>
Register
<div class="form-row">
<div class="form-controls">
<!-- <input type="text" name="email" class="field" placeholder="Email Address"> -->
<?php echo $this->Form->input('email',array('type' => 'text','placeholder' => 'Email Address','class' => 'field')); ?>
</div><!-- /.form-controls -->
</div><!-- /.form-row -->
<div class="form-row">
<div class="form-controls">
<!-- <input type="password" name="password" class="field" placeholder="Password"> -->
<?php echo $this->Form->input('user_type',array('type' => 'text','placeholder' => 'usertype like tutor or student','class' => 'field')); ?>
</div><!-- /.form-controls -->
</div><!-- /.form-row -->
<div class="form-row">
<div class="form-controls">
<!-- <input type="text" name="username" class="field" placeholder="Username"> -->
<?php echo $this->Form->input('username',array('type' => 'text','placeholder' => 'Username','class' => 'field')); ?>
</div><!-- /.form-controls -->
</div><!-- /.form-row -->
<div class="form-row">
<div class="form-controls">
<!-- <input type="password" name="password" class="field" placeholder="Password"> -->
<?php echo $this->Form->input('password',array('type' => 'password','placeholder' => 'Password','class' => 'field')); ?>
</div><!-- /.form-controls -->
</div><!-- /.form-row -->
<div class="form-row">
<div class="form-controls">
<!-- <input type="password" name="password_confirm" class="field" placeholder="Confirm Password"> -->
<?php echo $this->Form->input('password_confirm',array('type' => 'password','placeholder' => 'Confirm Password','class' => 'field')); ?>
</div><!-- /.form-controls -->
</div><!-- /.form-row -->
</div><!-- /.form-body -->
<?php echo $this->Form->input('status',array('default'=>'0','class' => 'field')); ?>
<div class="form-foot">
<div class="form-actions">
<!-- <input value="Register" class="form-btn" type="submit"> -->
<!-- <?= $this->Form->button(__('Submit')) ?> -->
<?php echo $this->Form->button('Submit',array('type' => 'submit','class' => 'form-btn','action' => 'register')); ?>
</div><!-- /.form-actions -->
</div><!-- /.form-foot -->
<!-- </form> -->
<?= $this->Form->end() ?>
</div><!-- /.form-sign -->
</div><!-- /.shell -->
</main>
//controller
<?php namespace App\Controller; use App\Controller\AppController; /** * UserDetails Controller * * @property \App\Model\Table\UserDetailsTable $UserDetails * * @method \App\Model\Entity\UserDetail[] paginate($object = null, array $settings = []) */ class UserDetailsController extends AppController { /** * Index method * * @return \Cake\Http\Response|null */ public function index() { $userDetails = $this->paginate($this->UserDetails); $this->set(compact('userDetails')); $this->set('_serialize', ['userDetails']); } // public function initialize() // { // parent::initialize(); // $this->Auth->allow(['logout','index']); // } public function logout() { $this->Flash->success('You are now logged out.'); return $this->redirect($this->Auth->logout()); } /** * View method * * @param string|null $id User Detail id. * @return \Cake\Http\Response|null * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. */ public function view($id = null) { $userDetail = $this->UserDetails->get($id, [ 'contain' => [] ]); $this->set('userDetail', $userDetail); $this->set('_serialize', ['userDetail']); } public function login() { if ($this->request->is('post')) { $userDetail = $this->Auth->identify(); if ($userDetail) { $this->Auth->setUser($userDetail); return $this->redirect($this->Auth->redirectUrl()); } $this->Flash->error('Your username or password is incorrect.'); } } /** * Add method * * @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise. */ public function register() { $userDetail = $this->UserDetails->newEntity(); if ($this->request->is('post')) { $userDetail = $this->UserDetails->patchEntity($userDetail, $this->request->getData()); if ($this->UserDetails->save($userDetail)) { $this->Flash->success(__('The user detail has been saved.')); return $this->redirect(['action' => 'index']); } $this->Flash->error(__('The user detail could not be saved. Please, try again.')); } $this->set(compact('userDetail')); $this->set('_serialize', ['userDetail']); } /** * Edit method * * @param string|null $id User Detail id. * @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise. * @throws \Cake\Network\Exception\NotFoundException When record not found. */ public function edit($id = null) { $userDetail = $this->UserDetails->get($id, [ 'contain' => [] ]); if ($this->request->is(['patch', 'post', 'put'])) { $userDetail = $this->UserDetails->patchEntity($userDetail, $this->request->getData()); if ($this->UserDetails->save($userDetail)) { $this->Flash->success(__('The user detail has been saved.')); return $this->redirect(['action' => 'index']); } $this->Flash->error(__('The user detail could not be saved. Please, try again.')); } $this->set(compact('userDetail')); $this->set('_serialize', ['userDetail']); } /** * Delete method * * @param string|null $id User Detail id. * @return \Cake\Http\Response|null Redirects to index. * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. */ public function delete($id = null) { $this->request->allowMethod(['post', 'delete']); $userDetail = $this->UserDetails->get($id); if ($this->UserDetails->delete($userDetail)) { $this->Flash->success(__('The user detail has been deleted.')); } else { $this->Flash->error(__('The user detail could not be deleted. Please, try again.')); } return $this->redirect(['action' => 'index']); } }