simpan sintax di bawah ini dengan tes.php
<script type="text/javascript">function show()
{
var n = document.myform.jumfile.value; //dwdwdw
var i;
var string = "";
for (i=0; i<=n-1; i++)
{
a=i+1;
string = string + "Email "+ a +": <input name=\"userfile"+ i + "\" type=\"text\"><br><br>";
}
document.getElementById('selectfile').innerHTML = string;
document.myform.n.value = n;
}
</script>
<form name="myform" enctype="multipart/form-data" action="proses.php" method="POST">
Pilih Jumlah Input
<select name="jumfile" onchange="show()">
<option value="0"> 0</option>
<option value="1"> 1</option>
<option value="2"> 2</option>
<option value="3"> 3</option>
<option value="4"> 4</option>
<option value="5"> 5</option>
<option value="6"> 6</option>
<option value="7"> 7</option>
<option value="8"> 8</option>
<option value="9"> 9</option>
<option value="10">10</option>
</select>
<br><br>
<input type="hidden" name="MAX_FILE_SIZE" value="20000000" />
<div id="selectfile">
</div>
<br>
<input type="hidden" name="n"/>
<input type="submit" name="submit" value="Send Mail" />
</form>
simpan sintax di bawah ini dengan proses.php
<?
$n = $_POST['n'];
for ($i=0; $i<=$n-1; $i++)
{
$to = $_POST[userfile.$i];
echo $to."<br>";
}
?>
0 komentar