2014-09-03 2 views
0

내가 CakePHP의 2.x를하고 있어요Cakephp 폼에서 HashTag을 얻는 방법 Submit?

내가지고 있지 않다 페이지를 제출할 때 내 현재의 URL이 http://sitename.com/users/edit_profile#step-2입니다 #setp-2

코드 :

//Setp-2 
<?php echo $this->form->create('User',array('action'=>'edit_profile')); ?> 
    <label>Smoke</label> 
    <?php $smoke_option = array('Heavy'=>'Heavy','Moderate'=>'Moderate','Light'=>'Light','Occasional'=>'Occasional','Non Smoker'=>'Non Smoker','Herb'=>'Herb'); 
    echo $this->form->input('smoke', array('options' => $smoke_option,'default'=>$getProfile['User_detail']['smoke'],'label'=>false,'div'=>false,'empty'=>'No Answer'));?> 
    </div> 
<?php echo $this->form->end();?> 

UsersController.php

public function edit_profile(){ 
    $this->layout='default';   
    if($this->request->is('post')){ 
     $data = $this->request->data; 
     $data['User']['id']=$this->Session->read('Auth.User.id'); 
     $updateProfile=$this->User->add_details($data); 
     if($updateProfile){ 
      $this->Session->setFlash(__('Your Profile Updated Successfully'), 'success_message'); 
      $this->redirect($this->referer()); 
     } 
    } 
} 

cakephp 양식의 해시 태그를받는 방법은 무엇입니까?

답변

0

사용

array('action'=>'edit_profile', '#' => 'step-2') 

이 추가 당신이 유사하게 당신이 당신을 사용할 수있는 URL에 필요로하는 # 단계-2? 또한

0

해시는 서버로 전송되지 않습니다.

심판 - http://stackoverflow.com/questions/940905/can-php-read-the-hash-portion-of-the-url

당신이 = 숨겨진 필드를 설정하고 값을 설정할 수 있지만.

document.location.hash

에 의해 해시에 액세스 할 수 있습니다.
관련 문제