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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.