Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

iterations not displaying

Community Beginner ,
Jun 02, 2013 Jun 02, 2013

Copy link to clipboard

Copied

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>

TOPICS
Server side applications

Views

427
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 03, 2013 Jun 03, 2013

Copy link to clipboard

Copied

LATEST

actually got this to work..

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

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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines