I have a page that is supposed to UPLOAD an image via this applet, but I am getting a SYNTAX ERROR message and do not see it right off so I am in need of a little check from the expert's eyes..

Does it all need to be within one main <?php beginning and end tag?

Anyhow the ERROR MESSAGE is:

Parse error: syntax error, unexpected '{' in /home/xxxxx/public_html/admin/modules/catalog/base_add_pic.php on line 37 [LINE 37 starts at if(isset($_POST['action']){ WITHIN THE CODE BELOW]

<?php 

define ('DIRSEP', DIRECTORY_SEPARATOR);

include realpath(dirname(__FILE__) . DIRSEP . '..' . DIRSEP . '..' . DIRSEP) . DIRSEP . "includes"  . DIRSEP . "nav"  . DIRSEP . "header2.php";

if (isset($_POST['base_id'])){
$base_id =$_GET['base_id'];
$dir = '../../../'.$config['products_dir'];
}else{
	$e->setError("No Base ID POSTED");
}

//check if base_id is valid from GET

$sql = "SELECT * FROM pr_base_info WHERE base_id = '$base_id'";

$count=$db->numRowsQ($sql);

$result=$db->query($sql);

if($count == 1){

 $clean_id=$base_id;
 $short_desc=$result['short_desc'];
 //find any associated pics
 $sql = "SELECT * FROM pr_base_pics where base_id = '$base_id'";
 $count=$db->numRowsQ($sql);
 if ($count>=1){
 	$pic_result=$db->query($sql);
 	}
} else {

 $e->setError("Sub group Id value is invalid");
}

if(isset($_POST['action']){
	if($POST['action']== 'delete'){

	if (isset($POST['pic_name'])){
		$pic_name = $POST['pic_name'].'.jpg';

		if(file_exists($dir.$pic_name)){
        unlink($dir.$main);
		}

		$delete_sql = "DELETE * FROM pr_base_pics WHERE pic_name = '$pic_name'";

		$db->query($delete_sql);

		$e->setError("$subgroup_name has been deleted...please wait.");

	?>

    <script type="text/javascript" language="javascript">

			setTimeout('window.top.location.reload();parent.parent.GB_hide();', 1000);

	</script>

    <center>

    <br /><br />

    <?php $e->showErrors();?>

    </center>

	<?php 

	}else{
		$e->setError("no pic name given to delete!");
	}

}elseif($POST['action']== 'add'){

}else{
	$e->setError("Bad Action Posted");
}
}else{

?>

<center><span class="title">Delete <?php echo $subgroup_name ?>?</span><br />

<?php $e->showErrors(); ?>

<form method="post" action="">

<table border='0' cellpadding='4'>

    <tr>

    		<td><?php echo "WARNING deleting this item will delete any assocaited pictures and it's extended items" ?></td>

        <td><input type="submit" value="Delete <?php echo $short_desc ?>" /><input type="hidden" name="action" value="delete" /></td>

        <td><input type="button" value="Cancel Deletion" onclick="parent.parent.GB_hide();" /></td>

    </tr>

</table>
}
	</form>

<applet id="jumpLoaderApplet" name="jumpLoaderApplet"
code="jmaster.jumploader.app.JumpLoaderApplet.class"
archive="<?php echo $config['admin_url'] ?>modules/catalog/mediautil_z.jar,sanselan_z.jar,jumploader_z.jar"
width="715"
height="500"
mayscript>
	<param name="uc_sendImageMetadata" value="true"/>
	<param name="uc_imageEditorEnabled" value="true"/>
    <param name="uc_useLosslessJpegTransformations" value="true"/>
	<param name="uc_uploadUrl" value="<?php echo $config['admin_url'] ?>modules/catalog/partitionedUploadHandler.php"/>
    <param name="uc_uploadScaledImages" value="true"/>
    <param name="uc_scaledInstanceNames" value="small,medium,large"/>
    <param name="uc_scaledInstanceDimensions" value="100x100,200x200,400x400"/>
    <param name="uc_scaledInstanceQualityFactors" value="900,800,700"/>
    <param name="uc_scaledInstanceQualityFactors" value="900,800,700"/>
    <param name="ac_fireUploaderFileAdded" value="true"/>
	<param name="ac_fireUploaderFileStatusChanged" value="true"/>
    <param name="uc_fileNamePattern" value="^.+\.(?i)((jpg)|(jpe)|(jpeg)|(gif)|(png)|(tif)|(tiff))$"/>
    <param name="vc_fileNamePattern" value="^.+\.(?i)((jpg)|(jpe)|(jpeg)|(gif)|(png)|(tif)|(tiff))$"/>
    <param name="vc_disableLocalFileSystem" value="false"/>
    <param name="vc_mainViewFileTreeViewVisible" value="true"/>
    <param name="vc_mainViewFileListViewVisible" value="true"/>
    <param name="uc_imageRotateEnabled" value="true"/>
    <param name="uc_scaledInstancePreserveMetadata" value="true"/>
    <param name="uc_deleteTempFilesOnRemove" value="true"/>
</applet>
<script>

<?php

}

include realpath(dirname(__FILE__) . DIRSEP . '..' . DIRSEP . '..' . DIRSEP) . DIRSEP . "includes"  . DIRSEP . "nav"  . DIRSEP . "footer2.php";

?>

MOD EDIT: [noparse]Generic

..

bbcode tags replaced with

..

[/noparse]; please use these instead when posting PHP code in the future.

    
    if(isset($_POST['action']){ 
    
    //change to
    
    
    if( isset($_POST['action']) ){ 
    

    You were missing a closing paren for your if statement.

      Dang it... I looked at all the brackets!! How did I miss that?

      Thanks greatly... That works.

        Glad I could help. Please mark the thread resolved when you get a chance.

          Write a Reply...