I have a form for users to upload images and comments on those images.
The whole form is held in a variable called (wait for it...) $form
I'd really appreciate some help coding a check to see that they have chosen 5 images and
written 5 comments when they hit "Upload" because all my attempts have failed dismally.
Here's the bad boy in question (the actual upload is handled by a separate page quoted in the form action).
All and any help much appreciated
best wishes
Monty
Code: Select all
{ $bodyCopy ='<span class="greyText">Upload your pictures and text.</span><br><br><br><br>' . $errorMsg;
$form = '<form enctype="multipart/form-data" action="coursework_insert.php?courseName='.$courseName.'" method="post">
<table width="59%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center"><span class="orangeText"><?php print "$error_msg"; ?></span></div></td>
</tr>
</table>
<br>
<table width="59%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="33"><span class="orangeText">Choose your images </span></td>
<td height="33"><span class="orangeText">Comment on each one (max 2000 characters) </span></td>
</tr>
<tr>
<td width="46%">Image 1:
<input name="userfile[]" type="file" id="userfile[]" size="0" maxlength="0"> </td>
<td width="54%"><textarea name="textarea[]" cols="40" rows="2" wrap="VIRTUAL" id="textarea[]" onKeyUp="EnforceMaximumLength(this,2000)"></textarea></td>
</tr>
<tr>
<td>Image 2:
<input name="userfile[]" type="file" id="userfile[]" size="0" maxlength="0"> </td>
<td><textarea name="textarea[]" cols="40" rows="2" wrap="VIRTUAL" id="textarea[]" onKeyUp="EnforceMaximumLength(this,2000)"></textarea></td>
</tr>
<tr>
<td>Image 3:
<input name="userfile[]" type="file" id="userfile[]" size="0" maxlength="0"> </td>
<td><textarea name="textarea[]" cols="40" rows="2" wrap="VIRTUAL" id="textarea[]" onKeyUp="EnforceMaximumLength(this,2000)"></textarea></td>
</tr>
<tr>
<td>Image 4:
<input name="userfile[]" type="file" id="userfile[]" size="0" maxlength="0"> </td>
<td><textarea name="textarea[]" cols="40" rows="2" wrap="VIRTUAL" id="textarea[]" onKeyUp="EnforceMaximumLength(this,2000)"></textarea></td>
</tr>
<tr>
<td>Image 5:
<input name="userfile[]" type="file" id="userfile[]" size="0" maxlength="0"> </td>
<td><textarea name="textarea[]" cols="40" rows="2" wrap="VIRTUAL" id="textarea[]" onKeyUp="EnforceMaximumLength(this,2000)"></textarea></td>
</tr>
<tr>
<td colspan="2"><div align="center"><br>
<input name="submit" type="submit" id="submit" value="Upload" />
</div></td>
</tr>
</table>
</form>';