質問編集履歴
4
質問文を編集しました。
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
```
|
|
24
24
|
public function profile()
|
|
25
25
|
{
|
|
26
|
-
|
|
26
|
+
$id=$this->request->data('profile');
|
|
27
|
+
//$this->request->$id('profile');
|
|
27
28
|
echo $id;
|
|
28
29
|
if (!$id)
|
|
29
30
|
{
|
3
エラー内容を追加しました。
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
また、下記のecho"1","2"はデバックのために記載しました。
|
|
5
5
|
その結果echo"2"の行が反応していないと分かりました。
|
|
6
6
|
|
|
7
|
+
エラー内容「Undefined variable: id」
|
|
8
|
+
|
|
7
9
|
profile.ctp Users/profilectp
|
|
8
10
|
```
|
|
9
11
|
<?php
|
|
@@ -21,10 +23,11 @@
|
|
|
21
23
|
```
|
|
22
24
|
public function profile()
|
|
23
25
|
{
|
|
26
|
+
$this->request->$id('profile');
|
|
24
27
|
echo $id;
|
|
25
28
|
if (!$id)
|
|
26
29
|
{
|
|
27
|
-
|
|
30
|
+
echo "1"; //throw new NotFoundException(__('Invalid user'));
|
|
28
31
|
}
|
|
29
32
|
$user = $this->Post->findById($id);
|
|
30
33
|
if(!$user)
|
|
@@ -46,5 +49,6 @@
|
|
|
46
49
|
$this->request->data = $post;
|
|
47
50
|
}
|
|
48
51
|
}
|
|
52
|
+
|
|
49
53
|
コード
|
|
50
54
|
```
|
2
質問文を修正しました。
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
```
|
|
9
9
|
<?php
|
|
10
10
|
echo $this->Form->create('Users',array('action'=>'profile'));
|
|
11
|
-
echo $this->Form->
|
|
11
|
+
echo $this->Form->hidden('username',['username']);
|
|
12
|
-
echo $this->Form->
|
|
12
|
+
echo $this->Form->hidden('pass',['password']);
|
|
13
|
-
echo $this->Form->
|
|
13
|
+
echo $this->Form->hidden('email',['email']);
|
|
14
14
|
echo $this->Form->end('Save');
|
|
15
15
|
?>
|
|
16
16
|
|
1
質問文を編集
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
CakePHPのコントローラーの変数にctpファイルのフォームから値を送り、格納させたいのですが、うまく変数($id)に入りません。こちらのコードで何か問題がありましたらご指摘をお願いしたいです。
|
|
2
2
|
profile関数はユーザー情報の編集機能
|
|
3
3
|
この$idにPOSTの値を入れたいと考えてます。
|
|
4
|
+
また、下記のecho"1","2"はデバックのために記載しました。
|
|
5
|
+
その結果echo"2"の行が反応していないと分かりました。
|
|
4
6
|
|
|
5
7
|
profile.ctp Users/profilectp
|
|
6
8
|
```
|
|
@@ -22,7 +24,7 @@
|
|
|
22
24
|
echo $id;
|
|
23
25
|
if (!$id)
|
|
24
26
|
{
|
|
25
|
-
|
|
27
|
+
echo"1"; //throw new NotFoundException(__('Invalid user'));
|
|
26
28
|
}
|
|
27
29
|
$user = $this->Post->findById($id);
|
|
28
30
|
if(!$user)
|