【发布时间】:2010-07-16 15:54:24
【问题描述】:
我正在学习 cakePHP 1.26。
我有一个 HTML Select 标记,其中包含如下选项:
<form method="post" action="/testing">
<table border="1">
<tr>
<td>
<select name="data[Test][number]">
<option name="editquote" value="[29,1]">One</option>
<option name="editquote" value="[24,2]">Two</option>
</select>
</td>
<tr>
<td>
<input type="submit" value="Send" class="mybutton">
</td>
</tr>
</table>
</form>
我选择了选项一并提交了表单。
这是 cakePHP 内置函数 Debug() 的结果
Array
(
[Test] => Array
(
[number] => [29,1]
)
)
我尝试使用以下代码从数据中获取两个数字(即本示例中的 29 和 1),但未能成功
$myData=$this->data;
$myData['Test']['number']; // [29, 1]
我应该怎么做才能分别得到这两个数字?
【问题讨论】:
标签: cakephp cakephp-1.2