我有这个代码:
$html .='<form enctype="multipart/form-data" action="upload.php" method="POST">
<input type="hidden" id="input_clone_id" name="input_clone_id" value="'.$row['id'].'"/>
<input type="hidden" id="input_clone_var" name="input_clone_var" value="V"/>
<input type="file" name="uploaded_files[]" id="input_clone" multiple="multiple" /><br />
<input type="submit" style="margin-left:0;float:left" value="Upload Files" />
</form>';
$html .='<a href="#" onclick="$.ajax({type: \'POST\',url: \'delete_pic.php\',data:{id:\''.$row['id_vila'].'\',var:\'V\',val:\''.$val.'\'},cache: false});window.location.reload( true );" style="background:url(\'images/icons/delete.png\') 50% -19px no-repeat;width:16px;height:16px;float:left;margin-left:10px;margin-top: 6px;"></a>';
除<form>
标签外,所有内容均已正确创建。它没有显示。我在这里做错了什么?
谢谢
编辑:
function formatImage2($col,$val,$row)
{
$html = '';
$new = explode( ';', $val );
for($j = 0; $j < count($new)-1; $j++)
{
$html .= '<a target="_blank" href="../images/gallery/'.$new[$j].'"><img style="border: none;" src="../images/gallery/'.$new[$j].'" alt="'.$new[$j].'" width="100" /></a>';
}
$html .='<form enctype="multipart/form-data" action="upload.php" method="POST">
<input type="hidden" id="input_clone_id" name="input_clone_id" value="'.$row['id'].'"/>
<input type="hidden" id="input_clone_var" name="input_clone_var" value="V"/>
<input type="file" name="uploaded_files[]" id="input_clone" multiple="multiple" /><br />
<input type="submit" style="margin-left:0;float:left" value="Upload Files" />
</form>';
$html .='<a href="#" onclick="$.ajax({type: \'POST\',url: \'delete_pic.php\',data:{id:\''.$row['id_vila'].'\',var:\'V\',val:\''.$val.'\'},cache: false});window.location.reload( true );" style="background:url(\'images/icons/delete.png\') 50% -19px no-repeat;width:16px;height:16px;float:left;margin-left:10px;margin-top: 6px;"></a>';
return $html;
}
我正在使用它来格式化数据库中的图片。
输出:
<td>
<input type="hidden" id="input_clone_id" name="input_clone_id" value="9">
<input type="hidden" id="input_clone_var" name="input_clone_var" value="V">
<input type="file" name="uploaded_files[]" id="input_clone" multiple="multiple"><br>
<input type="submit" style="margin-left:0;float:left" value="Upload Files">
<a href="#" onclick="$.ajax({type: 'POST',url: 'delete_pic.php',data:{id:'9',var:'V',val:''},cache: false});window.location.reload( true );" style="background:url('images/icons/delete.png') 50% -19px no-repeat;width:16px;height:16px;float:left;margin-left:10px;margin-top: 6px;"></a></td>