Código PHP:
<?php echo "¿alguna foto más?"?>:
<select name="images_number" id="images_number" onChange="ShowFields(this);">
<?php
$arrSelectedPackage = DataArray("ext_packages","id=".$selected_package);
for($i=0;$i<=($arrSelectedPackage["ads"]-1);$i++)
{
echo "<option value=\"".$i."\">".$i."</option>";
}
?>
</select>
<script>
function ShowFields(x)
{
var iFields = parseInt(x.options[x.selectedIndex].value);
var strCode = "";
strCode +="<table width=\"950px\" border=\"0\" cellspacing=\"8\">";
for(i=0;i<iFields;i++)
{
strCode +="<tr>";
strCode +="<td width=\"50%\" height=\"30px\"> <input type=\"file\" name=userfile"+(i+1)+"></td>";
strCode +="<input type=\"button\" style=\"background:url(images/cross.png); border:none\" onclick=\"if(userfile"+(i+1)+".value!='')userfile"+(i+1)+".value='';\" />";
strCode +="<label for=\"checkbox"+(i+1)+"\">Borrar archivo seleccionado</label>";
strCode +="</tr>";
}
strCode +="</table>";
document.getElementById("UploadFields").innerHTML = strCode;
}
</script>
<div id="UploadFields">
</div>