私はPHPに少し慣れていないので、この質問はばかげているかもしれません。
私はフォームを持っていると言います:
<form id="createNewGallery" name="newgallery" method="GET" action="code.php"><p><strong>please choose the number of pictures you want to upload:
</strong>
<select name="numOfPictures" id="numOfPictures">
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
</select></p>
<input name="submitNumOfPictures" type="submit" />
</form>
このフォームを送信して、後で別のフォームを追加したいのですが、この特定のページでそれを実行できることはわかっていますが、コードが乱雑にならないようにしたいので、code.php などの別のページで実行したいと考えています。
これはコードです:
<?php
if (isset($_GET['numOfPictures'])){
$times = $_GET['numOfPictures'];
for ($i = 1; $i <= $times; $i++){
echo '<br />select picture number '.$i.': <br />';
echo '<input name="file'.$i.'" type="file" />';
}
echo '</br><input name="submitFiles" type="submit" />';
}
私が得た結果は、新しいページcode.phpの出力ですが、インデックスphpにあったため、直後にフォームを作成したいと考えています。
インデックス ページで mt php コーディングを行うと、必要な結果が得られます。