
Originally Posted by
begeiste
Do you have a trouble for showing the upload form as the same as screen shot in the tutorial(preupload.php) that I mentioned? If you don't, can you let me know how to understand the codes <<<__HTML_END"and"__HTML_END;". I don't understand them. Do I need to create a header.php and footer.php individually to be able to display preupload.php correctly?
Thanks.
sorry for not replying back sooner, we've all been busy.
anyway, those tags "<<<__HTML_END"and"__HTML_END;" are another way of doing " or a '.
still not clear? 
here's an example of the code changed to way i'm going on about:
PHP Code:
<?php
include 'config.inc.php';
// initialization
$photo_upload_fields = '';
$counter = 1;
// If we want more fields, then use, preupload.php?number_of_fields=20
$number_of_fields = (isset($_GET['number_of_fields'])) ?
(int)($_GET['number_of_fields']) : 5;
// Firstly Lets build the Category List
$result = mysql_query('SELECT category_id,category_name FROM gallery_category');
while($row = mysql_fetch_array($result)) {
$photo_category_list .= '<option value="$row[0]">$row[1]</option>\n';
}
mysql_free_result( $result );
// Lets build the Image Uploading fields
while($counter <= $number_of_fields) {
$photo_upload_fields .= '
<tr><td>
Photo {$counter}:
<input name="photo_filename[]"
type="file" />
</td></tr>
<tr><td>
Caption:
<textarea name="photo_caption[]" cols="30"
rows="1"></textarea>
</td></tr>';
$counter++;
}
// Final Output
echo '<html>
<head>
<title>Lets upload Photos</title>
</head>
<body>
<form enctype="multipart/form-data"
action="upload.php" method="post"
name="upload_form">
<table width="90%" border="0"
align="center" style="width: 90%;">
<tr><td>
Select Category
<select name="category">
$photo_category_list
</select>
</td></tr>
<!—Insert the image fields here -->
$photo_upload_fields
<tr><td>
<input type="submit" name="submit"
value="Add Photos" />
</td></tr>
</table>
</form>
</body>
</html>';
?>
getting it now? 
here's a small snippet of the code:
the orig:
PHP Code:
$photo_category_list .= <<<__HTML_END
<option value="$row[0]">$row[1]</option>\n
__HTML_END;
the changed example:
PHP Code:
$photo_category_list .= '<option value="$row[0]">$row[1]</option>\n';
i personally prefer the changed example above, to me it makes it easy to understand and read. others will like the other method of using the html tags "<<<__HTML_END", etc...
the problem with the method that i like using is you may have to do something like the code below to get the code to work, only if there's an error message appearing in the web browser:
PHP Code:
<option value="'.$row[0].'">'.$row[1].'</option>
as for the other question:
Do I need to create a header.php and footer.php individually to be able to display preupload.php correctly?
you will need to create a header.php and footer.php to display the top and bottom of each page.
the preupload.php goes inbetween the header and footer then placed into the index page through the web browser.
spence
Bookmarks