Skip to main content
Participating Frequently
June 3, 2013
Question

iterations not displaying

  • June 3, 2013
  • 1 reply
  • 445 views

Hi,

I've developed a rather straight forward script to allow a webvisitor to upload their photos but before doing so they are brought to an initial page that asks how many photos they will be uploading? Upon response they are directed to page two with the said number of file insert form elements. I can get the script to work when in live mode of Dreamweaver but can't get it to work on my site's pages.

If someone could see what might be causing the problem that'd be very kind.

first page:

<html>

</head>

<body>

<?php $imgnumb = $_POST['imgcount']; ?>

<form action="second_page.php" method="post" enctype="multipart/form-data" name="form1" id="form1">

  <label for="imgcount">How Many Pics to Upload?</label>

  <input name="imgcount" type="text" id="imgcount" size="2" maxlength="2" /><br />

<input type="submit" name="submit" id="NEXT" value="NEXT" />

</form>

</body>

</html>

second page:

<body>

<form id="form1" name="form1" method="post" enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?>">

//begin loop to build the 'file' form element with '\' to escape double quotes..

<?php

for ($i=1; $i<=$imgnumb; $i++) {

   echo "<input type=\"file\" name=\"box.$i\"";

}    ?>

<br />

<input type="submit" name="upload" id="upload" value="UPLOAD" />

</form>

This topic has been closed for replies.

1 reply

JFWily2Author
Participating Frequently
June 3, 2013

actually got this to work..

append echo "<input type=\"file\" name=\"box.$i\"";

with ...name=\"box.$i."\" />"  it works!!