-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