<form name='mainform' method='post' action='do.php?ppc/workload' >
<?php
print "<input type='hidden' name='ppc_m_id' value='$id'>";
print "<table class='clean_form'>";
print "<tr><td colspan='2'><b>Attachment</b><input type='file' name='file' value=''></td></tr>";
print "<tr><td>Remarks</td><td><textarea name='sm_ppc_remarks' style='height:90;width:280'></textarea></td></tr>";
print "</table>";
?>
<input type="submit" value="submit">
</form>
</body>
class PPC extends CONTROLLER{
function workload(){
global $db, $auth;
$sql['ppc_m_id'] = $_POST['ppc_m_id'];
$sql['ppc_remarks_sales'] = $_POST['sm_ppc_remarks'];
$sql['ppc_sales_attachment'] = fs_upload($_FILES['file']);
$insert = insertformat($sql);
$query = $db->query("insert into ppc set $insert");
if($query)
$db->query("update sales set sm_ppc_remarks='{$sql['ppc_remarks_sales']}', sm_sales_attachment='{$sql['ppc_dpdate']}' where sm_id='{$sql['ppc_m_id']}' limit 1");
if($query){
message_set('Workload has been recorded');
goback();
}
}
}
当我填写备注文本区域时,它保存在我的数据库中,但是在保存附件(输入类型='文件')方面却没有保存..我不知道知道什么或缺少什么..非常感谢
答案 0 :(得分:1)
在<form>
标记
<form name='mainform' method='post' action='do.php?ppc/workload' enctype="multipart/form-data">
答案 1 :(得分:0)
缺少“enctype”
<form name='mainform' method='post' action='do.php?ppc/workload' enctype="multipart/form-data">