Jump to content

unexpected $end, just can't figure it out!


AnnieKay

Recommended Posts

Hi all

 

I've got an unexpected $end error like this:

Parse error: syntax error, unexpected $end in /home/.rico/ar15t0tl3/gofair.dreamhosters.com/final/CMS/upload_form.php on line 90

 

line 90 is the very last line of the code below (after the closing html tag) which is blank:

 

//Upload photos form - this will display the gallery that the user has chosen to add more photos to (if coming from the albums tag) or a list of albums to choose from if the button upload photos was chosen by itself.

<?php

include 'f_db_connect.php';
include 'f_html.php';

//initialize number of fields - can be coded to get number from url
$number_upload_fields = 3;


//If specific album is requested, show that album
if (isset($_POST['album_id'])){
$id= $_POST['album_id'];

$query="SELECT album_name FROM albums WHERE album_id='$id' ";
$result=mysql_query($query);

$album = mysql_fetch_assoc($result);

echo '<p>You have chosen to add photos to' . $album[album_name] . '.</p>' ;
}
else{    //create a list of the albums in the variable $album_list

$query= "SELECT album_id,album_name FROM albums";
$result = mysql_query($query);

//NB. This list is going to be an ol, so <li> tags are added - it will later be floated left
while($album_array = mysql_fetch_assoc($result)) {
	$album_list .=  '<li><input name="album_names[]"
	 class="checkbox" type="checkbox" value= "$album_array[album_id]" />
	 <label for="album_names[]"> $album_array[album_name] </label></li>';  
   }   

mysql_free_result( $result ); 



// Creates image uploading fields

while($counter <= $number_of_fields) { 

$photo_upload_fields .=  'Photo:  
 <input name="photo[]" type="file" />
 <br/> <label for="photo_titles[]"> Title: </label>  <input name="photo_titles[]" type="text" />
<br/>  <label for="photo_captions[]">Caption:   </label> <textarea name="photo_captions[]" cols="30" rows="6">
</textarea> <br/>';

 $counter++; 
} 


//-----------------HTML output of upload form itself -----------------


//NB. Arrays in which names that come from this form are contained are all the plural of the field names themselves e.g. photo titles will be in the $photo_titles[]
$title= 'title';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><?php echo $title; ?></title>

<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us" />

<link href="mainstyles.css" media="screen" rel="stylesheet" type="text/css" />

</head> 

<body>
<p>Navigation</p>

<h2>Upload photos</h2>

<form enctype="multipart/form-data"   action="upload_photos.php" method="post"   name="upload_form">  
<?php echo $photo_upload_fields ; ?> 
<fieldset>
<legend> Add to these albums:</legend>
<?php echo $album_list; ?>
</fieldset> 
<input type="submit" name="submit"  value="Add Photos" />
</form> 

</body>

</html>

 

I just can't seem to figure out why I'm getting the error - I can't see any uncompleted loops or anything... I think maybe I've been looking at this code for too long and a fresh pair of eyes might pick it up fast!

 

Thank you for any help you might be able to give me!

Annie

Link to comment
https://forums.phpfreaks.com/topic/91765-unexpected-end-just-cant-figure-it-out/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.