-2
我已经使用上面的代码创建了一个表单,但我提交了他们,我收到了空数据。cakephp +发布数据为空
我尝试调试通过
debug($this->data); //exit;
pr($_FILES);
pr($this->request->data); die;
但数据是空的。
<?php
echo $this->Form->create(false, array(
'class' => 'form-horizontal',
'type' => 'file',
'novalidate' => true,
'url' => '#users/test/background',
'id' => 'basic_form_validation',
));
?>
<div class="item in">
<div class="change-background">
<label>
Change Background :
</label>
<input type="file" name="background" id="background" value="" />
<input type="hidden" name="userid" value="<?= $user['id']; ?>" />
</div>
</div>
<input type="submit" value="Change" name="change" />
<?php echo $this->Form->end(); ?>
生成形式是:
<form accept-charset="utf-8" method="post" enctype="multipart/form-data" id="basic_form_validation" novalidate="novalidate" class="form-horizontal" action="#users/businesses/background">
<div style="display:none;"><input type="hidden" value="POST" name="_method"></div>
<div class="item in">
<div class="change-background">
<label>
Change Background :
</label>
<input type="file" value="" id="background" name="background">
<input type="hidden" value="20015" name="userid">
</div>
</div>
<input type="submit" name="change" value="Change">
我怎样才能解决这个问题,有什么问题。
通过按CTRL + U或F12来查看生成的源代码。 – Phiter
@PhiterFernandes:这就是输出结果'
完整的表单源代码。我对cakephp不太了解,但也许表格是错误的。 – Phiter